Package org.apache.juneau.http.header
Class BasicLongHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicLongHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
- Direct Known Subclasses:
- ContentLength
Category of headers that consist of a single long value.
 
Example
Content-Length: 300
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicLongHeader(String name, Long value) Constructor.BasicLongHeader(String name, String value) Constructor.BasicLongHeader(String name, Supplier<Long> value) Constructor with delayed value.
- 
Method SummaryModifier and TypeMethodDescriptionasLong()Provides the ability to perform fluent-style assertions on this header.getValue()static BasicLongHeaderStatic creator.static BasicLongHeaderStatic creator.static BasicLongHeaderStatic creator with delayed value.Return the value if present, otherwise returnother .toLong()Returns the header value as aLong.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- 
BasicLongHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Must be parsable by- Long.parseLong(String).
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicLongHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicLongHeaderConstructor 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- Long.parseLong(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.
 Must be parsable by- Long.parseLong(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 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
 
- 
asLong
- 
toLongReturns the header value as aLong.- Returns:
- The header value as a Long. Can benull .
 
- 
assertLongProvides the ability to perform fluent-style assertions on this header.Examples:// Validates the response body is not too large. client .get(URL ) .run() .getHeader("Length" ).asLongHeader().assertLong().isLessThan(100000);- 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 asLong().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 .
 
 
-