Class ImmutableCollectionsSerializers.JdkImmutableListSerializer
- java.lang.Object
-
- com.esotericsoftware.kryo.Serializer<T>
-
- com.esotericsoftware.kryo.serializers.CollectionSerializer<List<Object>>
-
- com.esotericsoftware.kryo.serializers.ImmutableCollectionsSerializers.JdkImmutableListSerializer
-
- Enclosing class:
- ImmutableCollectionsSerializers
public static final class ImmutableCollectionsSerializers.JdkImmutableListSerializer extends CollectionSerializer<List<Object>>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.esotericsoftware.kryo.serializers.CollectionSerializer
CollectionSerializer.BindCollection
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Object>copy(Kryo kryo, List<Object> original)Returns a copy of the specified object.protected List<Object>create(Kryo kryo, Input input, Class<? extends List<Object>> type, int size)Used byCollectionSerializer.read(Kryo, Input, Class)to create the new object.protected List<Object>createCopy(Kryo kryo, List<Object> original)Used byCollectionSerializer.copy(Kryo, Collection)to create the new object.List<Object>read(Kryo kryo, Input input, Class<? extends List<Object>> type)Reads bytes and returns a new object of the specified concrete type.-
Methods inherited from class com.esotericsoftware.kryo.serializers.CollectionSerializer
getElementClass, getElementSerializer, setElementClass, setElementClass, setElementsCanBeNull, setElementSerializer, write, writeHeader
-
Methods inherited from class com.esotericsoftware.kryo.Serializer
getAcceptsNull, isImmutable, setAcceptsNull, setImmutable
-
-
-
-
Method Detail
-
create
protected List<Object> create(Kryo kryo, Input input, Class<? extends List<Object>> type, int size)
Description copied from class:CollectionSerializerUsed byCollectionSerializer.read(Kryo, Input, Class)to create the new object. This can be overridden to customize object creation (eg to call a constructor with arguments), optionally reading bytes written inCollectionSerializer.writeHeader(Kryo, Output, Collection). The default implementation usesKryo.newInstance(Class)with special cases for ArrayList and HashSet.- Overrides:
createin classCollectionSerializer<List<Object>>
-
createCopy
protected List<Object> createCopy(Kryo kryo, List<Object> original)
Description copied from class:CollectionSerializerUsed byCollectionSerializer.copy(Kryo, Collection)to create the new object. This can be overridden to customize object creation, eg to call a constructor with arguments. The default implementation usesKryo.newInstance(Class).- Overrides:
createCopyin classCollectionSerializer<List<Object>>
-
read
public List<Object> read(Kryo kryo, Input input, Class<? extends List<Object>> type)
Description copied from class:SerializerReads bytes and returns a new object of the specified concrete type.Before Kryo can be used to read child objects,
Kryo.reference(Object)must be called with the parent object to ensure it can be referenced by the child objects. Any serializer that usesKryoto read a child object may need to be reentrant.This method should not be called directly, instead this serializer can be passed to
Kryoread methods that accept a serialier.- Overrides:
readin classCollectionSerializer<List<Object>>- Returns:
- May be null if
Serializer.getAcceptsNull()is true.
-
copy
public List<Object> copy(Kryo kryo, List<Object> original)
Description copied from class:SerializerReturns a copy of the specified object. The default implementation returns the original ifSerializer.isImmutable()is true, else throwsKryoException. Subclasses can optionall override this method to supportKryo.copy(Object).Before Kryo can be used to copy child objects,
Kryo.reference(Object)must be called with the copy to ensure it can be referenced by the child objects. A serializer that usesKryoto copy a child object may need to be reentrant.This method should not be called directly, instead this serializer can be passed to
Kryocopy methods that accept a serialier.- Overrides:
copyin classCollectionSerializer<List<Object>>
-
-