Class OracleJsonDurationSerde
java.lang.Object
io.micronaut.serde.oracle.jdbc.json.serde.OracleJsonDurationSerde
- All Implemented Interfaces:
Deserializer<Duration>, Serde<Duration>, Serializer<Duration>
@Singleton
@Order(-100)
public class OracleJsonDurationSerde
extends Object
implements Serde<Duration>
The custom serde for
Duration for Oracle JSON. Needed because default serde in Micronaut expects number (nanos)
to deserialize from, but we are getting it as String from Oracle JSON parser.- Since:
- 2.0.0
- Author:
- radovanradic
-
Nested Class Summary
Nested classes/interfaces inherited from interface Deserializer
Deserializer.DecoderContextNested classes/interfaces inherited from interface Serializer
Serializer.EncoderContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super Duration> type) voidserialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends Duration> type, Duration value) Serializes the given value using the passedEncoder.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Deserializer
createSpecific, deserializeNullable, getDefaultValueMethods inherited from interface Serializer
createSpecific, isAbsent, isDefault, isEmpty
-
Constructor Details
-
OracleJsonDurationSerde
public OracleJsonDurationSerde()
-
-
Method Details
-
deserialize
public Duration deserialize(Decoder decoder, Deserializer.DecoderContext decoderContext, io.micronaut.core.type.Argument<? super Duration> type) throws IOException Description copied from interface:Deserializer- Specified by:
deserializein interfaceDeserializer<Duration>- Parameters:
decoder- The decoder, nevernulldecoderContext- The decoder context, nevernulltype- The generic type to be deserialized- Returns:
- The deserialized object, never
null. UseDeserializer.deserializeNullable(Decoder, DecoderContext, Argument)when the decoder value can benull. - Throws:
IOException- If an error occurs during deserialization of the object
-
serialize
public void serialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends Duration> type, Duration value) throws IOException Description copied from interface:SerializerSerializes the given value using the passedEncoder.- Specified by:
serializein interfaceSerializer<Duration>- Parameters:
encoder- The encoder to usecontext- The encoder context, nevernulltype- Models the generic type of the valuevalue- The value to serialize, nevernull. Callers should encode null values directly.- Throws:
IOException- If an error occurs during serialization
-