Package com.esotericsoftware.kryo
Class SerializerFactory.ReflectionSerializerFactory
java.lang.Object
com.esotericsoftware.kryo.SerializerFactory.ReflectionSerializerFactory
- All Implemented Interfaces:
SerializerFactory
- Enclosing interface:
SerializerFactory
public static class SerializerFactory.ReflectionSerializerFactory
extends Object
implements SerializerFactory
This factory instantiates new serializers of a given class via reflection. The constructors of the given
serializerClass
must either take an instance of Kryo
and an instance of Class
as its parameter, take
only a Kryo
or Class
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 as they were just described.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.esotericsoftware.kryo.SerializerFactory
SerializerFactory.FieldSerializerFactory, SerializerFactory.ReflectionSerializerFactory, SerializerFactory.SingletonSerializerFactory, SerializerFactory.TaggedFieldSerializerFactory
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnewSerializer
(Kryo kryo, Class<?> type) Creates a new serializerstatic Serializer
newSerializer
(Kryo kryo, Class<? extends Serializer> serializerClass, Class<?> type) Creates a new instance of the specified serializer for serializing the specified class.
-
Field Details
-
serializerClass
-
-
Constructor Details
-
ReflectionSerializerFactory
-
-
Method Details
-
newSerializer
Description copied from interface:SerializerFactory
Creates a new serializer- Specified by:
newSerializer
in interfaceSerializerFactory
- Parameters:
kryo
- The serializer instance requesting the new serializer.type
- The type of the object that is to be serialized.- Returns:
- An implementation of a serializer that is able to serialize an object of type
type
.
-
newSerializer
public static Serializer newSerializer(Kryo kryo, Class<? extends Serializer> 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).
-