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 givenserializerClass
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 as they were just described.- Author:
- Rafael Winterhalter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.esotericsoftware.kryo.SerializerFactory
SerializerFactory.FieldSerializerFactory, SerializerFactory.ReflectionSerializerFactory, SerializerFactory.SingletonSerializerFactory, SerializerFactory.TaggedFieldSerializerFactory
-
-
Constructor Summary
Constructors Constructor Description ReflectionSerializerFactory(Class<? extends Serializer> serializerClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Serializer
newSerializer(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.
-
-
-
Constructor Detail
-
ReflectionSerializerFactory
public ReflectionSerializerFactory(Class<? extends Serializer> serializerClass)
-
-
Method Detail
-
newSerializer
public Serializer newSerializer(Kryo kryo, Class<?> type)
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).
-
-