|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.JsonSerializer<T>
public abstract class JsonSerializer<T>
Abstract class that defines API used by ObjectMapper
(and
other chained JsonSerializer
s too) to serialize Objects of
arbitrary types into JSON, using provided JsonGenerator
.
Nested Class Summary | |
---|---|
static class |
JsonSerializer.None
This marker class is only to be used with annotations, to indicate that no serializer is configured. |
Constructor Summary | |
---|---|
JsonSerializer()
|
Method Summary | |
---|---|
Class<T> |
handledType()
Method for accessing type of Objects this serializer can handle. |
abstract void |
serialize(T value,
JsonGenerator jgen,
SerializerProvider provider)
Method that can be called to ask implementation to serialize values of type this serializer handles. |
void |
serializeWithType(T value,
JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer)
Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsonSerializer()
Method Detail |
---|
public abstract void serialize(T value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException
value
- Value to serialize; can not be null.jgen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.
IOException
JsonProcessingException
public void serializeWithType(T value, JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException
Default implementation will ignore serialization of type information,
and just calls serialize(T, org.codehaus.jackson.JsonGenerator, org.codehaus.jackson.map.SerializerProvider)
: serializers that can embed
type information should override this to implement actual handling.
value
- Value to serialize; can not be null.jgen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.typeSer
- Type serializer to use for including type information
IOException
JsonProcessingException
public Class<T> handledType()
Default implementation will return null, which essentially means
same as returning Object.class
would; that is, that
nothing is known about handled type.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |