Package org.apache.juneau.swaps
Class DefaultingTemporalAccessor
java.lang.Object
org.apache.juneau.swaps.DefaultingTemporalAccessor
- All Implemented Interfaces:
TemporalAccessor
Wraps a
TemporalAccessor
to provide default values wherever possible instead of throwing unsupported field exceptions.
If working correctly, any DateTimeFormatter.parse(CharSequence)
method
should be able to be passed to any Temporal.from(TemporalAccessor)
static method (such as ZonedDateTime.from(TemporalAccessor)
).
See Also:
-
Constructor Summary
ConstructorDescriptionDefaultingTemporalAccessor
(TemporalAccessor inner, ZoneId zoneId) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
get
(TemporalField field) long
getLong
(TemporalField field) boolean
isSupported
(TemporalField field) <R> R
query
(TemporalQuery<R> query) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.time.temporal.TemporalAccessor
range
-
Constructor Details
-
DefaultingTemporalAccessor
Constructor.- Parameters:
inner
- The temporal accessor being wrapped.zoneId
- The default zone ID if it's not specified in the accessor.
-
-
Method Details
-
isSupported
- Specified by:
isSupported
in interfaceTemporalAccessor
-
query
- Specified by:
query
in interfaceTemporalAccessor
-
getLong
- Specified by:
getLong
in interfaceTemporalAccessor
-
get
- Specified by:
get
in interfaceTemporalAccessor
-