|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.JsonSerializer<T>
org.codehaus.jackson.map.ser.SerializerBase<T>
public abstract class SerializerBase<T>
Base class used by all standard serializers. Provides some convenience
methods for implementing SchemaAware
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer |
---|
JsonSerializer.None |
Field Summary | |
---|---|
protected Class<T> |
_handledType
|
Constructor Summary | |
---|---|
protected |
SerializerBase(Class<?> t,
boolean dummy)
Alternate constructor that is (alas!) needed to work around kinks of generic type handling |
protected |
SerializerBase(Class<T> t)
|
Method Summary | |
---|---|
protected ObjectNode |
createObjectNode()
|
protected ObjectNode |
createSchemaNode(String type)
|
protected ObjectNode |
createSchemaNode(String type,
boolean isOptional)
|
abstract JsonNode |
getSchema(SerializerProvider provider,
Type typeHint)
Get the representation of the schema to which this serializer will conform. |
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 |
wrapAndThrow(Throwable t,
Object bean,
int index)
|
void |
wrapAndThrow(Throwable t,
Object bean,
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. |
Methods inherited from class org.codehaus.jackson.map.JsonSerializer |
---|
serializeWithType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Class<T> _handledType
Constructor Detail |
---|
protected SerializerBase(Class<T> t)
protected SerializerBase(Class<?> t, boolean dummy)
Method Detail |
---|
public final 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 jgen, SerializerProvider provider) throws IOException, JsonGenerationException
JsonSerializer
serialize
in class JsonSerializer<T>
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
JsonGenerationException
public abstract JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException
SchemaAware
getSchema
in interface SchemaAware
provider
- The serializer provider.typeHint
- A hint about the type.
JsonMappingException
protected ObjectNode createObjectNode()
protected ObjectNode createSchemaNode(String type)
protected ObjectNode createSchemaNode(String type, boolean isOptional)
public void wrapAndThrow(Throwable t, Object bean, String fieldName) throws IOException
IOException
, or an unchecked exception.
Rules for wrapping and unwrapping are bit complicated; essentially:
JsonMappingException
are to be passed as is
IOException
public void wrapAndThrow(Throwable t, Object bean, int index) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |