Class LocalDateSerde
java.lang.Object
io.micronaut.serde.support.serdes.DefaultFormattedTemporalSerde<LocalDate>
io.micronaut.serde.support.serdes.LocalDateSerde
- All Implemented Interfaces:
Deserializer<LocalDate>
,Serde<LocalDate>
,Serializer<LocalDate>
,TemporalSerde<LocalDate>
@Singleton
public class LocalDateSerde
extends DefaultFormattedTemporalSerde<LocalDate>
implements TemporalSerde<LocalDate>
Local date serde.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.serde.Deserializer
Deserializer.DecoderContext
Nested classes/interfaces inherited from interface io.micronaut.serde.Serializer
Serializer.EncoderContext
-
Field Summary
Fields inherited from interface io.micronaut.serde.support.serdes.TemporalSerde
UTC
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LocalDateSerde
(SerdeConfiguration configuration) Allows configuring a default time format for temporal date/time types. -
Method Summary
Modifier and TypeMethodDescriptionprotected LocalDate
deserializeNonNullWithoutFormat
(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super LocalDate> type) A method that is invoked when the value is known not to be null.protected DateTimeFormatter
query()
protected void
serializeWithoutFormat
(Encoder encoder, Serializer.EncoderContext context, LocalDate value, io.micronaut.core.type.Argument<? extends LocalDate> type) Serializes the given value using the passedEncoder
.Methods inherited from class io.micronaut.serde.support.serdes.DefaultFormattedTemporalSerde
deserialize, serialize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.serde.Deserializer
allowNull, deserialize, getDefaultValue
Methods inherited from interface io.micronaut.serde.Serializer
isAbsent, isEmpty, serialize
Methods inherited from interface io.micronaut.serde.support.serdes.TemporalSerde
createSpecific, createSpecific
-
Constructor Details
-
LocalDateSerde
Allows configuring a default time format for temporal date/time types.- Parameters:
configuration
- The configuration
-
-
Method Details
-
getDefaultFormatter
- Specified by:
getDefaultFormatter
in classDefaultFormattedTemporalSerde<LocalDate>
- Returns:
- The default formatter.
-
query
- Specified by:
query
in interfaceTemporalSerde<LocalDate>
- Returns:
- The temporal query for the type.
-
serializeWithoutFormat
protected void serializeWithoutFormat(Encoder encoder, Serializer.EncoderContext context, LocalDate value, io.micronaut.core.type.Argument<? extends LocalDate> type) throws IOException Description copied from class:DefaultFormattedTemporalSerde
Serializes the given value using the passedEncoder
.- Specified by:
serializeWithoutFormat
in classDefaultFormattedTemporalSerde<LocalDate>
- Parameters:
encoder
- The encoder to usecontext
- The encoder context, nevernull
value
- The value, can benull
type
- Models the generic type of the value- Throws:
IOException
- If an error occurs during serialization
-
deserializeNonNullWithoutFormat
protected LocalDate deserializeNonNullWithoutFormat(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super LocalDate> type) throws IOException Description copied from class:DefaultFormattedTemporalSerde
A method that is invoked when the value is known not to be null.- Specified by:
deserializeNonNullWithoutFormat
in classDefaultFormattedTemporalSerde<LocalDate>
- Parameters:
decoder
- The decoderdecoderContext
- The decoder contexttype
- The type- Returns:
- The value
- Throws:
IOException
- if something goes wrong during deserialization
-