T
- The type to be serialized@Indexed(value=Serializer.class) public interface Serializer<T>
T
.Modifier and Type | Interface and Description |
---|---|
static interface |
Serializer.EncoderContext
Context object passes to the
serialize(Encoder, EncoderContext, Argument, Object) method. |
Modifier and Type | Method and Description |
---|---|
default Serializer<T> |
createSpecific(Serializer.EncoderContext context,
io.micronaut.core.type.Argument<? extends T> type)
Create a more specific serializer for the given definition.
|
default boolean |
isAbsent(Serializer.EncoderContext context,
T value)
Used for
JsonInclude.Include#NON_ABSENT checking. |
default boolean |
isEmpty(Serializer.EncoderContext context,
T value)
Used for
JsonInclude.Include#NON_EMPTY checking. |
void |
serialize(Encoder encoder,
Serializer.EncoderContext context,
io.micronaut.core.type.Argument<? extends T> type,
T value)
Serializes the given value using the passed
Encoder . |
@NonNull default Serializer<T> createSpecific(@NonNull Serializer.EncoderContext context, @NonNull io.micronaut.core.type.Argument<? extends T> type) throws SerdeException
context
- The encoder contexttype
- The type definition including any annotation metadataSerdeException
void serialize(@NonNull Encoder encoder, @NonNull Serializer.EncoderContext context, @NonNull io.micronaut.core.type.Argument<? extends T> type, @NonNull T value) throws java.io.IOException
Encoder
.encoder
- The encoder to usecontext
- The encoder context, never null
type
- Models the generic type of the valuevalue
- The value, can be null
java.io.IOException
- If an error occurs during serializationdefault boolean isEmpty(@NonNull Serializer.EncoderContext context, @Nullable T value)
JsonInclude.Include#NON_EMPTY
checking.context
- The encoder contextvalue
- The check to checktrue
if the value is emptydefault boolean isAbsent(@NonNull Serializer.EncoderContext context, @Nullable T value)
JsonInclude.Include#NON_ABSENT
checking.context
- The encoder contextvalue
- The value to checktrue
if the value is absent