Package org.apache.juneau.http.part
Class BasicIntegerPart
java.lang.Object
org.apache.juneau.http.part.BasicPart
org.apache.juneau.http.part.BasicIntegerPart
- All Implemented Interfaces:
NameValuePair
,Headerable
-
Constructor Summary
ConstructorDescriptionBasicIntegerPart
(String name, Integer value) Constructor.BasicIntegerPart
(String name, String value) Constructor.BasicIntegerPart
(String name, Supplier<Integer> value) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this part.getValue()
static BasicIntegerPart
Static creator.static BasicIntegerPart
Static creator with delayed value.Return the value if present, otherwise returnother .Returns The part value as anInteger
.Methods inherited from class org.apache.juneau.http.part.BasicPart
asHeader, assertName, assertValue, canCast, cast, getName, getRawValue, of, ofPair, toString
-
Constructor Details
-
BasicIntegerPart
Constructor.- Parameters:
name
- The part name. Must not benull .value
- The part value. Can benull .
-
BasicIntegerPart
Constructor.- Parameters:
name
- The part name. Must not benull .value
- The part value supplier. Can benull or supplynull .
-
BasicIntegerPart
Constructor.null and empty values are treated asnull . Otherwise parses usingInteger.valueOf(String)
.- Parameters:
name
- The part name. Must not benull .value
- The part value. Can benull .
-
-
Method Details
-
of
Static creator.- Parameters:
name
- The part name.value
- The part value.- Returns:
- A new
BasicIntegerPart
object, ornull if the name or value isnull .
-
of
Static creator with delayed value.Part value is re-evaluated on each call to
NameValuePair.getValue()
.- Parameters:
name
- The part name.value
- The part value supplier.- Returns:
- A new
BasicIntegerPart
object, ornull if the name or supplier isnull .
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicPart
-
asInteger
-
toInteger
Returns The part value as anInteger
.- Returns:
- The part value as an
Integer
, ornull if the valuenull .
-
assertInteger
Provides the ability to perform fluent-style assertions on this part.- Returns:
- A new fluent assertion object.
- Throws:
AssertionError
- If assertion failed.
-
orElse
Return 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 benull .- Returns:
- The value, if present, otherwise
other .
-