public abstract class StdSerializer<T> extends JsonSerializer<T> implements JsonFormatVisitable, SchemaAware, java.io.Serializable
SchemaAwareJsonSerializer.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, withFilterIdpublic 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
JsonSerializerserialize 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.IOExceptionpublic void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
acceptJsonFormatVisitor in interface JsonFormatVisitableacceptJsonFormatVisitor in class JsonSerializer<T>typeHint - Type of element (entity like property) being visitedJsonMappingExceptionpublic JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint) throws JsonMappingException
getSchema in interface SchemaAwareprovider - The serializer provider.typeHint - A hint about the type.JsonMappingExceptionpublic JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint, boolean isOptional) throws JsonMappingException
getSchema in interface SchemaAwareprovider - The serializer provider.typeHint - A hint about the type.isOptional - Is the type optionalJsonMappingExceptionpublic 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.IOExceptionpublic void wrapAndThrow(SerializerProvider provider, java.lang.Throwable t, java.lang.Object bean, int index) throws java.io.IOException
java.io.IOExceptionCopyright © 2010 - 2023 Adobe. All Rights Reserved