Package io.micronaut.serde.util
Interface CustomizableSerializer<T>
- Type Parameters:
T- The serializer type
- All Superinterfaces:
Serializer<T>
- All Known Implementing Classes:
ObjectArraySerde,ObjectSerializer
The type of serializer that requires a specific implementation by calling
Serializer.createSpecific(Serializer.EncoderContext, Argument).- Author:
- Denis Stepanov
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.serde.Serializer
Serializer.EncoderContext -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanisAbsent(Serializer.EncoderContext context, T value) Used forJsonInclude.Include#NON_ABSENTchecking.default booleanisEmpty(Serializer.EncoderContext context, T value) Used forJsonInclude.Include#NON_EMPTYchecking.default voidserialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T value) Serializes the given value using the passedEncoder.Methods inherited from interface io.micronaut.serde.Serializer
createSpecific, isDefault
-
Method Details
-
serialize
default void serialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T value) throws IOException Description copied from interface:SerializerSerializes the given value using the passedEncoder.- Specified by:
serializein interfaceSerializer<T>- Parameters:
encoder- The encoder to usecontext- The encoder context, nevernulltype- Models the generic type of the valuevalue- The value, can benull- Throws:
IOException- If an error occurs during serialization
-
isEmpty
Description copied from interface:SerializerUsed forJsonInclude.Include#NON_EMPTYchecking.- Specified by:
isEmptyin interfaceSerializer<T>- Parameters:
context- The encoder contextvalue- The check to check- Returns:
- Return
trueif the value is empty
-
isAbsent
Description copied from interface:SerializerUsed forJsonInclude.Include#NON_ABSENTchecking.- Specified by:
isAbsentin interfaceSerializer<T>- Parameters:
context- The encoder contextvalue- The value to check- Returns:
- Return
trueif the value is absent
-