Package com.esotericsoftware.kryo
Class SerializerFactory.ReflectionSerializerFactory<T extends Serializer>
- java.lang.Object
-
- com.esotericsoftware.kryo.SerializerFactory.BaseSerializerFactory<T>
-
- com.esotericsoftware.kryo.SerializerFactory.ReflectionSerializerFactory<T>
-
- All Implemented Interfaces:
SerializerFactory<T>
- Enclosing interface:
- SerializerFactory<T extends Serializer>
public static class SerializerFactory.ReflectionSerializerFactory<T extends Serializer> extends SerializerFactory.BaseSerializerFactory<T>
This factory instantiates new serializers of a given class via reflection. The constructors of the given serializer class must either take an instance ofKryo
and an instance ofClass
as its parameter, take only aKryo
orClass
as its only argument, or take no arguments. If several of the described constructors are found, the first found constructor is used, in the order they were just described.- Author:
- Rafael Winterhalter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.esotericsoftware.kryo.SerializerFactory
SerializerFactory.BaseSerializerFactory<T extends Serializer>, SerializerFactory.CompatibleFieldSerializerFactory, SerializerFactory.FieldSerializerFactory, SerializerFactory.ReflectionSerializerFactory<T extends Serializer>, SerializerFactory.SingletonSerializerFactory<T extends Serializer>, SerializerFactory.TaggedFieldSerializerFactory, SerializerFactory.VersionFieldSerializerFactory
-
-
Constructor Summary
Constructors Constructor Description ReflectionSerializerFactory(Class<T> serializerClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
newSerializer(Kryo kryo, Class type)
Creates and configures a new serializer.static <T extends Serializer>
TnewSerializer(Kryo kryo, Class<T> serializerClass, Class type)
Creates a new instance of the specified serializer for serializing the specified class.-
Methods inherited from class com.esotericsoftware.kryo.SerializerFactory.BaseSerializerFactory
isSupported
-
-
-
-
Method Detail
-
newSerializer
public T newSerializer(Kryo kryo, Class type)
Description copied from interface:SerializerFactory
Creates and configures a new serializer.- Parameters:
kryo
- The Kryo instance that will be used with the new serializer.type
- The type of the object that the serializer will serialize.
-
newSerializer
public static <T extends Serializer> T newSerializer(Kryo kryo, Class<T> serializerClass, Class type)
Creates a new instance of the specified serializer for serializing the specified class. Serializers must have a zero argument constructor or one that takes (Kryo), (Class), or (Kryo, Class).
-
-