public abstract class StdSerializer<T> extends JsonSerializer<T> implements JsonFormatVisitable, SchemaAware, java.io.Serializable
SchemaAware
JsonSerializer.None
Modifier and Type | Method and Description |
---|---|
void |
acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor,
JavaType typeHint)
Default implementation specifies no format.
|
JsonNode |
getSchema(SerializerProvider provider,
java.lang.reflect.Type typeHint)
Default implementation simply claims type is "string"; usually
overriden by custom serializers.
|
JsonNode |
getSchema(SerializerProvider provider,
java.lang.reflect.Type typeHint,
boolean isOptional)
Default implementation simply claims type is "string"; usually
overriden by custom serializers.
|
java.lang.Class<T> |
handledType()
Method for accessing type of Objects this serializer can handle.
|
abstract void |
serialize(T value,
JsonGenerator gen,
SerializerProvider provider)
Method that can be called to ask implementation to serialize
values of type this serializer handles.
|
void |
wrapAndThrow(SerializerProvider provider,
java.lang.Throwable t,
java.lang.Object bean,
int index) |
void |
wrapAndThrow(SerializerProvider provider,
java.lang.Throwable t,
java.lang.Object bean,
java.lang.String fieldName)
Method that will modify caught exception (passed in as argument)
as necessary to include reference information, and to ensure it
is a subtype of
IOException , or an unchecked exception. |
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId
public java.lang.Class<T> handledType()
JsonSerializer
Default implementation will return null, which essentially means
same as returning Object.class
would; that is, that
nothing is known about handled type.
handledType
in class JsonSerializer<T>
public abstract void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws java.io.IOException
JsonSerializer
serialize
in class JsonSerializer<T>
value
- Value to serialize; can not be null.gen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.java.io.IOException
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
acceptJsonFormatVisitor
in interface JsonFormatVisitable
acceptJsonFormatVisitor
in class JsonSerializer<T>
typeHint
- Type of element (entity like property) being visitedJsonMappingException
public JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint) throws JsonMappingException
getSchema
in interface SchemaAware
provider
- The serializer provider.typeHint
- A hint about the type.JsonMappingException
public JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint, boolean isOptional) throws JsonMappingException
getSchema
in interface SchemaAware
provider
- The serializer provider.typeHint
- A hint about the type.isOptional
- Is the type optionalJsonMappingException
public void wrapAndThrow(SerializerProvider provider, java.lang.Throwable t, java.lang.Object bean, java.lang.String fieldName) throws java.io.IOException
IOException
, or an unchecked exception.
Rules for wrapping and unwrapping are bit complicated; essentially:
JsonMappingException
are to be passed as is
java.io.IOException
public void wrapAndThrow(SerializerProvider provider, java.lang.Throwable t, java.lang.Object bean, int index) throws java.io.IOException
java.io.IOException
Copyright © 2010 - 2020 Adobe. All Rights Reserved