Package org.apache.juneau.http.part
Class BasicLongPart
java.lang.Object
org.apache.juneau.http.part.BasicPart
org.apache.juneau.http.part.BasicLongPart
- All Implemented Interfaces:
NameValuePair,Headerable
-
Constructor Summary
ConstructorsConstructorDescriptionBasicLongPart(String name, Long value) Constructor.BasicLongPart(String name, String value) Constructor.BasicLongPart(String name, Supplier<Long> value) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionasLong()Provides the ability to perform fluent-style assertions on this part.getValue()static BasicLongPartStatic creator.static BasicLongPartStatic creator with delayed value.Return the value if present, otherwise returnother .toLong()Returns The part value as aLong.Methods inherited from class org.apache.juneau.http.part.BasicPart
asHeader, assertName, assertValue, canCast, cast, getName, getRawValue, of, ofPair, toString
-
Constructor Details
-
BasicLongPart
Constructor.- Parameters:
name- The part name. Must not benull .value- The part value. Can benull .
-
BasicLongPart
Constructor.null and empty values are treated asnull . Otherwise parses usingLong.valueOf(String).- Parameters:
name- The part name. Must not benull .value- The part value. Can benull .
-
BasicLongPart
Constructor.- Parameters:
name- The part name. Must not benull .value- The part value supplier. Can benull or supplynull .
-
-
Method Details
-
of
Static creator.- Parameters:
name- The part name.value- The part value.- Returns:
- A new
BasicLongPartobject, 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
BasicLongPartobject, ornull if the name or supplier isnull .
-
asLong
-
assertLong
Provides the ability to perform fluent-style assertions on this part.- Returns:
- A new fluent assertion object.
- Throws:
AssertionError- If assertion failed.
-
getValue
- Specified by:
getValuein interfaceNameValuePair- Overrides:
getValuein classBasicPart
-
orElse
Return 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 benull .- Returns:
- The value, if present, otherwise
other .
-
toLong
Returns The part value as aLong.- Returns:
- The part value as a
Long, ornull if the valuenull .
-