@Internal @Singleton @Primary public class ObjectSerializer extends java.lang.Object implements Serializer<java.lang.Object>
Serializer for general Object values. For deserialization, deserializes to
standard types
like Number, String, Boolean, Map and List.
This class is used in multiple scenarios:
Object property in a serializable bean.JsonMapper.writeValue(java.io.OutputStream, java.lang.Object)(gen, Object.class)Serializer.EncoderContext| Constructor and Description |
|---|
ObjectSerializer(SerdeIntrospections introspections,
SerializationConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
Serializer<java.lang.Object> |
createSpecific(io.micronaut.core.type.Argument<?> type,
Serializer.EncoderContext encoderContext)
Create a more specific serializer for the given definition.
|
protected java.util.List<io.micronaut.serde.support.serializers.SerBean.SerProperty<java.lang.Object,java.lang.Object>> |
getWriteProperties(io.micronaut.serde.support.serializers.SerBean<java.lang.Object> serBean)
Obtains the write properties for this serializer.
|
void |
serialize(Encoder encoder,
Serializer.EncoderContext context,
java.lang.Object value,
io.micronaut.core.type.Argument<?> type)
Serializes the given value using the passed
Encoder. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisAbsent, isEmptypublic ObjectSerializer(SerdeIntrospections introspections, SerializationConfiguration configuration)
public Serializer<java.lang.Object> createSpecific(io.micronaut.core.type.Argument<?> type, Serializer.EncoderContext encoderContext)
SerializercreateSpecific in interface Serializer<java.lang.Object>type - The type definition including any annotation metadataencoderContext - The encoder contextpublic final void serialize(Encoder encoder, Serializer.EncoderContext context, java.lang.Object value, io.micronaut.core.type.Argument<?> type) throws java.io.IOException
SerializerEncoder.serialize in interface Serializer<java.lang.Object>encoder - The encoder to usecontext - The encoder context, never nullvalue - The value, can be nulltype - Models the generic type of the valuejava.io.IOException - If an error occurs during serialization@NonNull protected java.util.List<io.micronaut.serde.support.serializers.SerBean.SerProperty<java.lang.Object,java.lang.Object>> getWriteProperties(io.micronaut.serde.support.serializers.SerBean<java.lang.Object> serBean)
serBean - The serialization bean.null