|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.SerializerFactory
org.codehaus.jackson.map.ser.BasicSerializerFactory
public class BasicSerializerFactory
Factory class that can provide serializers for standard JDK classes,
as well as custom classes that extend standard classes or implement
one of "well-known" interfaces (such as Collection
).
Since all the serializers are eagerly instantiated, and there is
no additional introspection or customazibility of these types,
this factory is stateless. This means that other delegating
factories (or SerializerProvider
s) can just use the
shared singleton instance via static instance
field.
Nested Class Summary | |
---|---|
static class |
BasicSerializerFactory.BooleanSerializer
|
static class |
BasicSerializerFactory.CalendarSerializer
For time values we should use timestamp, since that is about the only thing that can be reliably converted between date-based objects and json. |
static class |
BasicSerializerFactory.ClassSerializer
Also: default bean access will not do much good with Class.class. |
static class |
BasicSerializerFactory.DoubleSerializer
|
static class |
BasicSerializerFactory.FloatSerializer
|
static class |
BasicSerializerFactory.IntegerSerializer
|
static class |
BasicSerializerFactory.IntLikeSerializer
Similar to BasicSerializerFactory.IntegerSerializer , but will not cast to Integer:
instead, cast is to Number , and conversion is
by calling Number.intValue() . |
static class |
BasicSerializerFactory.LongSerializer
|
static class |
BasicSerializerFactory.NullSerializer
To allow for special handling for null values (in Objects, Arrays, root-level), handling for nulls is done via serializers too. |
static class |
BasicSerializerFactory.NumberSerializer
As a fallback, we may need to use this serializer for other types of Number s (custom types). |
static class |
BasicSerializerFactory.SerializableSerializer
|
static class |
BasicSerializerFactory.SqlDateSerializer
Compared to regular BasicSerializerFactory.UtilDateSerializer , we do use String
representation here. |
static class |
BasicSerializerFactory.SqlTimeSerializer
|
static class |
BasicSerializerFactory.StringSerializer
This is the special serializer for regular String s. |
static class |
BasicSerializerFactory.UtilDateSerializer
For efficiency, we will serialize Dates as longs, instead of potentially more readable Strings. |
Field Summary | |
---|---|
static BasicSerializerFactory |
instance
Stateless global singleton instance that should be used for factories that want to use delegation to access standard serializers. |
Constructor Summary | |
---|---|
protected |
BasicSerializerFactory()
We will provide default constructor to allow sub-classing, but make it protected so that no non-singleton instances of the class will be instantiated. |
Method Summary | ||
---|---|---|
protected JsonSerializer<?> |
buildMapSerializer(Class<?> type,
SerializationConfig config)
Helper method that handles configuration details when constructing serializers for Map types. |
|
|
createSerializer(Class<T> type,
SerializationConfig config)
Main serializer constructor method. |
|
JsonSerializer<?> |
findSerializerByAddonType(Class<?> type,
SerializationConfig config)
Reflection-based serialized find method, which checks if given class implements one of recognized "add-on" interfaces. |
|
JsonSerializer<?> |
findSerializerByLookup(Class<?> type,
SerializationConfig config)
Fast lookup-based accessor method, which will only check for type itself, but not consider super-classes or implemented interfaces. |
|
JsonSerializer<?> |
findSerializerByPrimaryType(Class<?> type,
SerializationConfig config)
Reflection-based serialized find method, which checks if given class is a sub-type of one of well-known classes, or implements a "primary" interface. |
|
protected JsonSerializer<Object> |
findSerializerFromAnnotation(SerializationConfig config,
Annotated a)
Helper method called to check if a class or method has an annotation (@link org.codehaus.jackson.map.ser.JsonSerialize#using) that tells the class to use for serialization. |
|
JsonSerializer<?> |
getNullSerializer()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final BasicSerializerFactory instance
Constructor Detail |
---|
protected BasicSerializerFactory()
Method Detail |
---|
public <T> JsonSerializer<T> createSerializer(Class<T> type, SerializationConfig config)
createSerializer
in class SerializerFactory
type
- Type to be serializedconfig
- Generic serialization configurationpublic final JsonSerializer<?> getNullSerializer()
public final JsonSerializer<?> findSerializerByLookup(Class<?> type, SerializationConfig config)
public final JsonSerializer<?> findSerializerByPrimaryType(Class<?> type, SerializationConfig config)
public final JsonSerializer<?> findSerializerByAddonType(Class<?> type, SerializationConfig config)
Iterable
, but their main
function is usually something else. The reason for
protected JsonSerializer<Object> findSerializerFromAnnotation(SerializationConfig config, Annotated a)
protected JsonSerializer<?> buildMapSerializer(Class<?> type, SerializationConfig config)
Map
types.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |