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 java.lang.Object implements SerializerFactory
This factory instantiates new serializers of a given class via reflection. The constructors of the givenserializerClassmust either take an instance ofKryoand an instance ofClassas its parameter, take only aKryoorClassas 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 Modifier and Type Field Description private java.lang.Class<? extends Serializer>serializerClass
-
Constructor Summary
Constructors Constructor Description ReflectionSerializerFactory(java.lang.Class<? extends Serializer> serializerClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SerializernewSerializer(Kryo kryo, java.lang.Class<?> type)Creates a new serializerstatic SerializernewSerializer(Kryo kryo, java.lang.Class<? extends Serializer> serializerClass, java.lang.Class<?> type)Creates a new instance of the specified serializer for serializing the specified class.
-
-
-
Field Detail
-
serializerClass
private final java.lang.Class<? extends Serializer> serializerClass
-
-
Constructor Detail
-
ReflectionSerializerFactory
public ReflectionSerializerFactory(java.lang.Class<? extends Serializer> serializerClass)
-
-
Method Detail
-
newSerializer
public Serializer newSerializer(Kryo kryo, java.lang.Class<?> type)
Description copied from interface:SerializerFactoryCreates a new serializer- Specified by:
newSerializerin 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, java.lang.Class<? extends Serializer> serializerClass, java.lang.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).
-
-