Package org.bson.codecs.jsr310
Class LocalTimeCodec
java.lang.Object
org.bson.codecs.jsr310.LocalTimeCodec
LocalTime Codec.
Encodes and decodes LocalTime objects to and from DateTime. Data is stored to millisecond accuracy.
Converts the LocalTime values to and from EpochDay at ZoneOffset.UTC.
- Since:
- 3.7
- MongoDB documentation
- reference/bson-types
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode(BsonReader reader, DecoderContext decoderContext) Decodes a BSON value from the given reader into an instance of the type parameterT.voidencode(BsonWriter writer, LocalTime value, EncoderContext encoderContext) Encode an instance of the type parameterTinto a BSON value.Returns the Class instance that this encodes.
-
Constructor Details
-
LocalTimeCodec
public LocalTimeCodec()
-
-
Method Details
-
decode
Description copied from interface:DecoderDecodes a BSON value from the given reader into an instance of the type parameterT.- Parameters:
reader- the BSON readerdecoderContext- the decoder context- Returns:
- an instance of the type parameter
T.
-
encode
Encode an instance of the type parameterTinto a BSON value.Converts the
LocalTimetoZoneOffset.UTCat EpochDay viaLocalTime.atDate(LocalDate)andChronoLocalDateTime.toInstant(ZoneOffset).- Parameters:
writer- the BSON writer to encode intovalue- the value to encodeencoderContext- the encoder context
-
getEncoderClass
Description copied from interface:EncoderReturns the Class instance that this encodes. This is necessary because Java does not reify generic types.- Returns:
- the Class instance that this encodes.
-