Package org.apache.juneau.http.part
Class BasicDatePart
java.lang.Object
org.apache.juneau.http.part.BasicPart
org.apache.juneau.http.part.BasicDatePart
- All Implemented Interfaces:
NameValuePair
,Headerable
-
Constructor Summary
ConstructorDescriptionBasicDatePart
(String name, String value) Constructor.BasicDatePart
(String name, ZonedDateTime value) Constructor.BasicDatePart
(String name, Supplier<ZonedDateTime> value) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionProvides the ability to perform fluent-style assertions on this part.Returns The part value as aZonedDateTime
wrapped in anOptional
.getValue()
static BasicDatePart
of
(String name, ZonedDateTime value) Static creator.static BasicDatePart
of
(String name, Supplier<ZonedDateTime> value) Static creator with delayed value.orElse
(ZonedDateTime other) Return the value if present, otherwise returnother .Returns The part value as aZonedDateTime
.Methods inherited from class org.apache.juneau.http.part.BasicPart
asHeader, assertName, assertValue, canCast, cast, getName, getRawValue, of, ofPair, toString
-
Constructor Details
-
BasicDatePart
Constructor.- Parameters:
name
- The part name. Must not benull .value
- The part value. Can benull .
-
BasicDatePart
Constructor.- Parameters:
name
- The part name. Must not benull .value
- The part value supplier. Can benull or supplynull .
-
BasicDatePart
Constructor.null and empty values are treated asnull . Otherwise parses usingDateTimeFormatter.ISO_DATE_TIME
.- 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
BasicDatePart
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
BasicDatePart
object, ornull if the name or supplier isnull .
-
getValue
- Specified by:
getValue
in interfaceNameValuePair
- Overrides:
getValue
in classBasicPart
-
asZonedDateTime
Returns The part value as aZonedDateTime
wrapped in anOptional
.- Returns:
- The part value as a
ZonedDateTime
wrapped in anOptional
. Nevernull .
-
toZonedDateTime
Returns The part value as aZonedDateTime
.- Returns:
- The part value as a
ZonedDateTime
, ornull if the valuenull .
-
assertZonedDateTime
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
asZonedDateTime().orElse( .other )- Parameters:
other
- The value to be returned if there is no value present, can benull .- Returns:
- The value, if present, otherwise
other .
-