Class PojoCodec
java.lang.Object
org.springframework.integration.codec.kryo.AbstractKryoCodec
org.springframework.integration.codec.kryo.PojoCodec
- All Implemented Interfaces:
Codec
- Direct Known Subclasses:
MessageCodec
Kryo Codec that can encode and decode arbitrary types. Classes and associated
Serializer
s may be registered via
KryoRegistrar
s.- Since:
- 4.2
- Author:
- David Turanski, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.codec.kryo.AbstractKryoCodec
pool
-
Constructor Summary
ConstructorDescriptionPojoCodec
(List<KryoRegistrar> kryoRegistrars) Create an instance with zero to many KryoRegistrars.PojoCodec
(List<KryoRegistrar> kryoRegistrars, boolean useReferences) Create an instance with zero to many KryoRegistrars.PojoCodec
(KryoRegistrar kryoRegistrar) Create an instance with a single KryoRegistrar.PojoCodec
(KryoRegistrar kryoRegistrar, boolean useReferences) Create an instance with a single KryoRegistrar. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureKryoInstance
(com.esotericsoftware.kryo.Kryo kryo) Subclasses implement this to configure the kryo instance.protected <T> T
doDecode
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<T> type) Subclasses implement this method to decode with Kryo.protected void
doEncode
(com.esotericsoftware.kryo.Kryo kryo, Object object, com.esotericsoftware.kryo.io.Output output) Subclasses implement this method to encode with Kryo.Methods inherited from class org.springframework.integration.codec.kryo.AbstractKryoCodec
decode, decode, encode, encode
-
Constructor Details
-
PojoCodec
public PojoCodec() -
PojoCodec
Create an instance with a single KryoRegistrar.- Parameters:
kryoRegistrar
- the registrar.
-
PojoCodec
Create an instance with zero to many KryoRegistrars.- Parameters:
kryoRegistrars
- a list KryoRegistrars.
-
PojoCodec
Create an instance with a single KryoRegistrar.- Parameters:
kryoRegistrar
- the registrar.useReferences
- set to false if references are not required (if the object graph is known to be acyclical). The default is 'true' which is less performant but more flexible.
-
PojoCodec
Create an instance with zero to many KryoRegistrars.- Parameters:
kryoRegistrars
- a list KryoRegistrars.useReferences
- set to false if references are not required (if the object graph is known to be acyclical). The default is 'true' which is less performant but more flexible.
-
-
Method Details
-
doEncode
protected void doEncode(com.esotericsoftware.kryo.Kryo kryo, Object object, com.esotericsoftware.kryo.io.Output output) Description copied from class:AbstractKryoCodec
Subclasses implement this method to encode with Kryo.- Specified by:
doEncode
in classAbstractKryoCodec
- Parameters:
kryo
- the Kryo instanceobject
- the object to encodeoutput
- the Kryo Output instance
-
doDecode
protected <T> T doDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<T> type) Description copied from class:AbstractKryoCodec
Subclasses implement this method to decode with Kryo.- Specified by:
doDecode
in classAbstractKryoCodec
- Type Parameters:
T
- the type for decoded object- Parameters:
kryo
- the Kryo instanceinput
- the Kryo Input instancetype
- the class of the decoded object- Returns:
- the decoded object
-
configureKryoInstance
protected void configureKryoInstance(com.esotericsoftware.kryo.Kryo kryo) Description copied from class:AbstractKryoCodec
Subclasses implement this to configure the kryo instance. This is invoked on each new Kryo instance when it is created.- Specified by:
configureKryoInstance
in classAbstractKryoCodec
- Parameters:
kryo
- the Kryo instance
-