Class ErrorCatchingSerializer<T>
java.lang.Object
io.micronaut.serde.support.serializers.ErrorCatchingSerializer<T>
- Type Parameters:
T- The serializer type
- All Implemented Interfaces:
Serializer<T>
The errors catching
Serializer.- Author:
- Denis Stepanov
-
Nested Class Summary
Nested classes/interfaces inherited from interface Serializer
Serializer.EncoderContext -
Method Summary
Modifier and TypeMethodDescriptionfinal Serializer<T> createSpecific(Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type) Create a more specific serializer for the given definition.final Serializer<T> Returns the wrapped serializer.final booleanisAbsent(Serializer.EncoderContext context, @Nullable T value) Used forJsonInclude.Include#NON_ABSENTchecking.final booleanisEmpty(Serializer.EncoderContext context, @Nullable T value) Used forJsonInclude.Include#NON_EMPTYchecking.final voidserialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T values) 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 Serializer
isDefault
-
Method Details
-
serialize
public final void serialize(Encoder encoder, Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type, T values) 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 valuevalues- The value to serialize, nevernull. Callers should encode null values directly.- Throws:
IOException- If an error occurs during serialization
-
createSpecific
public final Serializer<T> createSpecific(Serializer.EncoderContext context, io.micronaut.core.type.Argument<? extends T> type) throws SerdeException Description copied from interface:SerializerCreate a more specific serializer for the given definition.- Specified by:
createSpecificin interfaceSerializer<T>- Parameters:
context- The encoder contexttype- The type definition including any annotation metadata- Returns:
- The more specific serializer
- Throws:
SerdeException
-
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
-
getSerializer
Returns the wrapped serializer.- Returns:
- The wrapped serializer
-