Class InstantSerde
java.lang.Object
io.micronaut.serde.support.serdes.DefaultFormattedTemporalSerde<Instant>
io.micronaut.serde.support.serdes.InstantSerde
- All Implemented Interfaces:
Deserializer<Instant>
,Serde<Instant>
,Serializer<Instant>
,TemporalSerde<Instant>
@Singleton
public class InstantSerde
extends DefaultFormattedTemporalSerde<Instant>
implements TemporalSerde<Instant>
Serde used for
Instant
.- Since:
- 1.0.0
-
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Instant
deserializeNonNullWithoutFormat
(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super Instant> 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, Instant value, io.micronaut.core.type.Argument<? extends Instant> 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
-
InstantSerde
-
-
Method Details
-
getDefaultFormatter
- Specified by:
getDefaultFormatter
in classDefaultFormattedTemporalSerde<Instant>
- Returns:
- The default formatter.
-
query
- Specified by:
query
in interfaceTemporalSerde<Instant>
- Returns:
- The temporal query for the type.
-
serializeWithoutFormat
protected void serializeWithoutFormat(Encoder encoder, Serializer.EncoderContext context, Instant value, io.micronaut.core.type.Argument<? extends Instant> type) throws IOException Description copied from class:DefaultFormattedTemporalSerde
Serializes the given value using the passedEncoder
.- Specified by:
serializeWithoutFormat
in classDefaultFormattedTemporalSerde<Instant>
- 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 Instant deserializeNonNullWithoutFormat(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super Instant> 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<Instant>
- Parameters:
decoder
- The decoderdecoderContext
- The decoder contexttype
- The type- Returns:
- The value
- Throws:
IOException
- if something goes wrong during deserialization
-