Package org.apache.juneau.http.header
Class BasicBooleanHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicBooleanHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
Category of headers that consist of a single boolean value.
 
Example
Foo: true
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicBooleanHeader(String name, Boolean value) Constructor.BasicBooleanHeader(String name, String value) Constructor.BasicBooleanHeader(String name, Supplier<Boolean> value) Constructor with delayed value.
- 
Method SummaryModifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this header.getValue()booleanisTrue()Returnstrue if the header value istrue .static BasicBooleanHeaderStatic creator.static BasicBooleanHeaderStatic creator.static BasicBooleanHeaderStatic creator with delayed value.Return the value if present, otherwise returnother .Returns the header value as aBoolean.Methods inherited from class org.apache.juneau.http.header.BasicHeaderassertName, assertStringValue, asString, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, orElse, toString
- 
Constructor Details- 
BasicBooleanHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Must be parsable by- Boolean.parseBoolean(String).
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicBooleanHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicBooleanHeaderConstructor with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
 
- 
- 
Method Details- 
ofStatic creator.- Parameters:
- name- The header name.
- value- The header value.
 Must be parsable by- Boolean.parseBoolean(String).
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
getValue- Specified by:
- getValuein interface- NameValuePair
- Overrides:
- getValuein class- BasicHeader
 
- 
asBoolean
- 
toBooleanReturns the header value as aBoolean.- Returns:
- The header value as a Boolean. Can benull .
 
- 
isTrueReturnstrue if the header value istrue .- Returns:
- true if the header value is- true .
 
- 
assertBooleanProvides the ability to perform fluent-style assertions on this header.Examples:// Validates the response header Foo is true. client .get(URL ) .run() .getHeader("Foo" ).asBooleanHeader().assertBoolean().isTrue();- Returns:
- A new fluent assertion object.
- Throws:
- AssertionError- If assertion failed.
 
- 
orElseReturn the value if present, otherwise returnother .This is a shortened form for calling asBoolean().orElse( .other )- Parameters:
- other- The value to be returned if there is no value present, can be- null .
- Returns:
- The value, if present, otherwise other .
 
 
-