public class DefaultingTemporalAccessor extends Object implements TemporalAccessor
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)
).
Constructor and Description |
---|
DefaultingTemporalAccessor(TemporalAccessor inner,
ZoneId zoneId)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
get(TemporalField field) |
long |
getLong(TemporalField field) |
boolean |
isSupported(TemporalField field) |
<R> R |
query(TemporalQuery<R> query) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
range
public DefaultingTemporalAccessor(TemporalAccessor inner, ZoneId zoneId)
inner
- The temporal accessor being wrapped.zoneId
- The default zone ID if it's not specified in the accessor.public boolean isSupported(TemporalField field)
isSupported
in interface TemporalAccessor
public <R> R query(TemporalQuery<R> query)
query
in interface TemporalAccessor
public long getLong(TemporalField field)
getLong
in interface TemporalAccessor
public int get(TemporalField field)
get
in interface TemporalAccessor
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.