Package io.micronaut.serde
Interface Serializer<T>
- Type Parameters:
 T- The type to be serialized
- All Known Subinterfaces:
 CustomizableSerializer<T>,NullableSerde<T>,NumberSerde<N>,ObjectSerializer<T>,Serde<T>,SerdeRegistrar<T>,SerializerRegistrar<T>,TemporalSerde<T>
- All Known Implementing Classes:
 AbstractBsonSerde,AbstractOracleJsonSerde,BsonRepresentationSerde,ByteBufferSerde,CodecBsonDecoder,CustomizedObjectArraySerializer,DefaultFormattedTemporalSerde,HealthStatusSerde,InetAddressSerde,InstantSerde,LocalDateSerde,LocalDateTimeSerde,LocalTimeSerde,ObjectArraySerde,ObjectSerializer,OffsetDateTimeSerde,OracleJsonBinarySerde,OracleJsonDurationSerde,OracleJsonLocaleDateSerde,OracleJsonLocaleDateTimeSerde,OracleJsonLocaleTimeSerde,OracleJsonOffsetDateTimeSerde,OracleJsonZonedDateTimeSerde,YearSerde,ZonedDateTimeSerde
Models a build time serializer. That is a class computed at build-time that can
 be used to serialize an instance of 
Serializer.- Author:
 - Jonas Konrad, graemerocher
 
- 
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceContext object passes to theserialize(Encoder, EncoderContext, Argument, Object)method. - 
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull Serializer<T>createSpecific(@NonNull Serializer.EncoderContext context, @NonNull io.micronaut.core.type.Argument<? extends T> type) Create a more specific serializer for the given definition.default booleanisAbsent(@NonNull Serializer.EncoderContext context, T value) Used forJsonInclude.Include#NON_ABSENTchecking.default booleanisEmpty(@NonNull Serializer.EncoderContext context, T value) Used forJsonInclude.Include#NON_EMPTYchecking.voidserialize(@NonNull Encoder encoder, @NonNull Serializer.EncoderContext context, @NonNull io.micronaut.core.type.Argument<? extends T> type, T value) Serializes the given value using the passedEncoder. 
- 
Method Details
- 
createSpecific
@NonNull default @NonNull Serializer<T> createSpecific(@NonNull @NonNull Serializer.EncoderContext context, @NonNull @NonNull io.micronaut.core.type.Argument<? extends T> type) throws SerdeException Create a more specific serializer for the given definition.- Parameters:
 context- The encoder contexttype- The type definition including any annotation metadata- Returns:
 - The more specific serializer
 - Throws:
 SerdeException
 - 
serialize
void serialize(@NonNull @NonNull Encoder encoder, @NonNull @NonNull Serializer.EncoderContext context, @NonNull @NonNull io.micronaut.core.type.Argument<? extends T> type, @NonNull T value) throws IOException Serializes the given value using the passedEncoder.- 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
Used forJsonInclude.Include#NON_EMPTYchecking.- Parameters:
 context- The encoder contextvalue- The check to check- Returns:
 - Return 
trueif the value is empty 
 - 
isAbsent
Used forJsonInclude.Include#NON_ABSENTchecking.- Parameters:
 context- The encoder contextvalue- The value to check- Returns:
 - Return 
trueif the value is absent 
 
 -