Package org.apache.juneau.http.header
Class HttpBooleanHeader
java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
org.apache.juneau.http.header.HttpBooleanHeader
- All Implemented Interfaces:
HttpHeader
Base for boolean headers.
- Since:
- 9.2.1
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpBooleanHeader(String name, Boolean typedValue) Constructor.protectedHttpBooleanHeader(String name, String wireValue) Constructor.protectedHttpBooleanHeader(String name, Supplier<?> supplier, int lazyMode) Constructor with lazy value supplier. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()Returns the wire-format value of this header.booleanisTrue()Returnstrue if the parsed value istrue .static HttpBooleanHeaderCreates anHttpBooleanHeaderwith the given typed value.static HttpBooleanHeaderCreates anHttpBooleanHeaderby parsing the given wire-format value.Returns the parsed value of this header, or the specified default if unset.Returns the parsed value of this header.Methods inherited from class org.apache.juneau.http.header.HttpHeaderBean
equals, equalsIgnoreCase, getName, hashCode, of, toString
-
Field Details
-
LAZY_WIRE_STRING
- See Also:
-
LAZY_BOOLEAN
- See Also:
-
-
Constructor Details
-
HttpBooleanHeader
Constructor.- Parameters:
name- Header name. Must not benull .wireValue- Wire value (e.g."true"). Can benull or empty, in which case the parsed value isnull .
-
HttpBooleanHeader
Constructor.- Parameters:
name- Header name. Must not benull .typedValue- The boolean value. Can benull , in which case the parsed value isnull .
-
HttpBooleanHeader
Constructor with lazy value supplier.- Parameters:
name- Header name. Must not benull .supplier- The lazy value supplier. Must not benull .lazyMode- EitherLAZY_WIRE_STRINGorLAZY_BOOLEAN.
-
-
Method Details
-
of
Creates anHttpBooleanHeaderby parsing the given wire-format value.- Parameters:
name- Header name. Must not benull.wireValue- Wire value (e.g."true"). May benull.- Returns:
- A new instance. Never
null.
-
of
Creates anHttpBooleanHeaderwith the given typed value.- Parameters:
name- Header name. Must not benull.typedValue- The boolean value. May benull.- Returns:
- A new instance. Never
null.
-
asBoolean
-
getValue
Returns the wire-format value of this header.- Specified by:
getValuein interfaceHttpHeader- Overrides:
getValuein classHttpHeaderBean- Returns:
- The wire value, or
null if the value is unset.
-
isTrue
Returnstrue if the parsed value istrue .- Returns:
true if the parsed value istrue ;false if it isfalse or unset.
-
orElse
Returns the parsed value of this header, or the specified default if unset.- Parameters:
other- The default value. Can benull to allow anull result when the header is unset.- Returns:
- The parsed value, or
other if the value is unset. Can benull ifother isnull .
-
toBoolean
Returns the parsed value of this header.- Returns:
- The parsed value, or
null if the value is unset.
-