Package org.apache.juneau.http.header
Class BasicIntegerHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicIntegerHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
- Direct Known Subclasses:
- Age,- MaxForwards
Category of headers that consist of a single integer value.
 
Example
Age: 300
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicIntegerHeader(String name, Integer value) Constructor.BasicIntegerHeader(String name, String value) Constructor.BasicIntegerHeader(String name, Supplier<Integer> value) Constructor with delayed value.
- 
Method SummaryModifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this header.getValue()static BasicIntegerHeaderStatic creator.static BasicIntegerHeaderStatic creator.static BasicIntegerHeaderStatic creator with delayed value.Return the value if present, otherwise returnother .Returns the header value as anInteger.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- 
BasicIntegerHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Must be parsable using- Integer.parseInt(String).
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicIntegerHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicIntegerHeaderConstructor 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 using- Integer.parseInt(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
 
- 
asInteger
- 
toIntegerReturns the header value as anInteger.- Returns:
- The header value as an Integer. Can benull .
 
- 
assertIntegerProvides the ability to perform fluent-style assertions on this header.Examples:// Validates the response content is older than 1. client .get(URL ) .run() .getHeader("Age" ).asIntegerHeader().assertInteger().isGreaterThan(1);- 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 asInteger().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 .
 
 
-