public abstract class SerializerFactory extends Object
This class is the primary interface to object serialization in Vertigo. Use this class to load type-specific serializers as follows:
JsonObject json = SerializerFactory.getSerializer(MyClass.class).serialize(myClassObj);
Note that when loading a serializer for a class, the factory will load the serializer
for the first class that implements JsonSerializable in the class hierarchy.
If no class in the hierarchy implements JsonSerializable then the default
serializer will be used.
In order to serialize an object with the default serializer, classes must implement the
JsonSerializable interface. In most cases, the default serializer will
automatically serialize all primitives, collections, and JsonSerializable
properties within the serializable object. For more advanced serialization, look at the
Jackson annotations documentation.
| Constructor and Description |
|---|
SerializerFactory() |
| Modifier and Type | Method and Description |
|---|---|
abstract Serializer |
createSerializer(Class<?> clazz)
Creates a new serializer instance.
|
static Serializer |
getSerializer(Class<?> type)
Gets a serializer instance.
|
public static Serializer getSerializer(Class<?> type)
type - The serializer type.public abstract Serializer createSerializer(Class<?> clazz)
type - The serializer class.Copyright © 2013-2014. All Rights Reserved.