Top Description Fields Constructors Methods
tools.jackson.jr.extension.javatime

public Class JavaTimeReaderWriterProvider

extends ReaderWriterProvider
Class Inheritance
Imports
java.time.LocalDateTime, .OffsetDateTime, .ZoneId, .ZonedDateTime, java.time.format.DateTimeFormatter, .DateTimeFormatterBuilder, java.time.temporal.ChronoField, tools.jackson.jr.ob.api.*, tools.jackson.jr.ob.impl.JSONReader, .JSONWriter

Provider for ValueReaders and ValueWriters for Date/Time types supported by Java Time Extension.

Field Summary

Modifier and TypeField and Description
private ZoneId
protected static final DateTimeFormatter
protected static final DateTimeFormatter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static DateTimeFormatter

Returns:

Formatter
_createFormatter
(boolean
Set to true to set UTC to be the default offset for non-local date times that do not have an offset. Set to false when handling local date times.
includeUtcDefault
)

Create a forgiving date time formatter that allows different interpretations of ISO 8601 strings to be parsed.

public ValueReader
findValueReader(JSONReader readContext, Class<?> type)

Overrides tools.jackson.jr.ob.api.ReaderWriterProvider.findValueReader.

Method called to find custom reader for given type that is NOT one of special container types (java.util.Collection, java.util.Map): typically value is a scalar, Bean or Enum.

public ValueWriter
public JavaTimeReaderWriterProvider

Returns:

Reference for chaining
withLocalTimeZone
(ZoneId
Time zone to apply, or null
localZoneId
)

Setter to configure a time zone that is to be applied when a zoned ISO 8601 date time needs to be converted to a LocalDateTime.

public JavaTimeReaderWriterProvider

Returns:

Reference for chaining
withSystemDefaultTimeZone
()

Convenience method to quickly set the system default time zone as the preferred one.

Inherited from tools.jackson.jr.ob.api.ReaderWriterProvider:
findCollectionReaderfindMapReader

Field Detail

_localZoneIdback to summary
private ZoneId _localZoneId
LOCAL_FORMATTERback to summary
protected static final DateTimeFormatter LOCAL_FORMATTER
OFFSET_FORMATTERback to summary
protected static final DateTimeFormatter OFFSET_FORMATTER

Constructor Detail

JavaTimeReaderWriterProviderback to summary
public JavaTimeReaderWriterProvider()

Method Detail

_createFormatterback to summary
private static DateTimeFormatter _createFormatter(boolean includeUtcDefault)

Create a forgiving date time formatter that allows different interpretations of ISO 8601 strings to be parsed.

Parameters
includeUtcDefault:boolean

Set to true to set UTC to be the default offset for non-local date times that do not have an offset. Set to false when handling local date times.

Returns:DateTimeFormatter

Formatter

Since
2.20
findValueReaderback to summary
public ValueReader findValueReader(JSONReader readContext, Class<?> type)

Overrides tools.jackson.jr.ob.api.ReaderWriterProvider.findValueReader.

Doc from tools.jackson.jr.ob.api.ReaderWriterProvider.findValueReader.

Method called to find custom reader for given type that is NOT one of special container types (java.util.Collection, java.util.Map): typically value is a scalar, Bean or Enum.

Annotations
@Override
findValueWriterback to summary
public ValueWriter findValueWriter(JSONWriter writeContext, Class<?> type)

Overrides tools.jackson.jr.ob.api.ReaderWriterProvider.findValueWriter.

Annotations
@Override
withLocalTimeZoneback to summary
public JavaTimeReaderWriterProvider withLocalTimeZone(ZoneId localZoneId)

Setter to configure a time zone that is to be applied when a zoned ISO 8601 date time needs to be converted to a LocalDateTime. Can be set to null to apply the UTC default.

Parameters
localZoneId:ZoneId

Time zone to apply, or null

Returns:JavaTimeReaderWriterProvider

Reference for chaining

Since
2.20
withSystemDefaultTimeZoneback to summary
public JavaTimeReaderWriterProvider withSystemDefaultTimeZone()

Convenience method to quickly set the system default time zone as the preferred one. This is equivalent to calling: withLocalTimeZone(ZoneId.systemDefault()).

Returns:JavaTimeReaderWriterProvider

Reference for chaining

Since
2.20