Package org.apache.juneau.http.header
Class HttpLongHeader
java.lang.Object
org.apache.juneau.http.header.HttpHeaderBean
org.apache.juneau.http.header.HttpLongHeader
- All Implemented Interfaces:
HttpHeader
- Direct Known Subclasses:
ContentLength
Base for long headers.
- Since:
- 9.2.1
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttpLongHeader(String name, Long typedValue) Constructor.protectedHttpLongHeader(String name, String wireValue) Constructor.protectedHttpLongHeader(String name, Supplier<?> supplier, int lazyMode) Constructor with lazy value supplier. -
Method Summary
Modifier and TypeMethodDescriptionasLong()getValue()Returns the wire-format value of this header.static HttpLongHeaderCreates anHttpLongHeaderwith the given typed value.static HttpLongHeaderCreates anHttpLongHeaderby parsing the given wire-format value.Returns the parsed value of this header, or the specified default if unset.toLong()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_LONG
- See Also:
-
-
Constructor Details
-
HttpLongHeader
Constructor.- Parameters:
name- Header name. Must not benull .wireValue- Wire value. Can benull or empty, in which case the parsed value isnull .
-
HttpLongHeader
Constructor.- Parameters:
name- Header name. Must not benull .typedValue- The long value. Can benull , in which case the parsed value isnull .
-
HttpLongHeader
Constructor with lazy value supplier.- Parameters:
name- Header name. Must not benull .supplier- The lazy value supplier. Must not benull .lazyMode- EitherLAZY_WIRE_STRINGorLAZY_LONG.
-
-
Method Details
-
of
Creates anHttpLongHeaderby parsing the given wire-format value.- Parameters:
name- Header name. Must not benull.wireValue- Wire value. May benullor empty.- Returns:
- A new instance. Never
null.
-
of
Creates anHttpLongHeaderwith the given typed value.- Parameters:
name- Header name. Must not benull.typedValue- The long value. May benull.- Returns:
- A new instance. Never
null.
-
asLong
-
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.
-
orElse
Returns the parsed value of this header, or the specified default if unset.- Parameters:
other- The default value. Can benull .- Returns:
- The parsed value, or
other if the value is unset. Can benull ifother isnull .
-
toLong
Returns the parsed value of this header.- Returns:
- The parsed value, or
null if the value is unset.
-