|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.jackson.map.module.SimpleSerializers
public class SimpleSerializers
Simple implementation Serializers which allows registration of
serializers based on raw (type erased class).
It can work well for basic bean and scalar type serializers, but is not
a good fit for handling generic types (like Maps and Collections).
Type registrations are assumed to be general; meaning that registration of serializer
for a super type will also be used for handling subtypes, unless an exact match
is found first. As an example, handler for CharSequence would also be used
serializing StringBuilder instances, unless a direct mapping was found.
| Field Summary | |
|---|---|
protected HashMap<ClassKey,JsonSerializer<?>> |
_classMappings
Class-based mappings that are used both for exact and sub-class matches. |
protected HashMap<ClassKey,JsonSerializer<?>> |
_interfaceMappings
Interface-based matches. |
| Constructor Summary | |
|---|---|
SimpleSerializers()
|
|
| Method Summary | ||
|---|---|---|
protected JsonSerializer<?> |
_findInterfaceMapping(Class<?> cls,
ClassKey key)
|
|
|
addSerializer(Class<? extends T> type,
JsonSerializer<T> ser)
|
|
void |
addSerializer(JsonSerializer<?> ser)
Method for adding given serializer for type that JsonSerializer.handledType()
specifies (which MUST return a non-null class; and can NOT be Object, as a
sanity check). |
|
JsonSerializer<?> |
findSerializer(SerializationConfig config,
JavaType type,
BeanDescription beanDesc,
BeanProperty property)
Method called serialization framework first time a serializer is needed for specified type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HashMap<ClassKey,JsonSerializer<?>> _classMappings
protected HashMap<ClassKey,JsonSerializer<?>> _interfaceMappings
| Constructor Detail |
|---|
public SimpleSerializers()
| Method Detail |
|---|
public void addSerializer(JsonSerializer<?> ser)
JsonSerializer.handledType()
specifies (which MUST return a non-null class; and can NOT be Object, as a
sanity check).
For serializers that do not declare handled type, use the variant that takes
two arguments.
ser -
public <T> void addSerializer(Class<? extends T> type,
JsonSerializer<T> ser)
public JsonSerializer<?> findSerializer(SerializationConfig config,
JavaType type,
BeanDescription beanDesc,
BeanProperty property)
Serializers
findSerializer in interface Serializersconfig - Serialization configuration in usetype - Fully resolved type of instances to serializebeanDesc - Additional information about type; will always be of type
BasicBeanDescription (that is,
safe to cast to this more specific type)property - Property that contains values to serialize
protected JsonSerializer<?> _findInterfaceMapping(Class<?> cls,
ClassKey key)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||