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
Serializers may be registered via
KryoRegistrars.- Since:
- 4.2
- Author:
- David Turanski, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.codec.kryo.AbstractKryoCodec
pool -
Constructor Summary
ConstructorsConstructorDescriptionPojoCodec(@Nullable List<KryoRegistrar> kryoRegistrars, boolean useReferences) Create an instance with zero to many KryoRegistrars.PojoCodec(List<KryoRegistrar> kryoRegistrars) Create an instance with zero to many KryoRegistrars.PojoCodec(@Nullable KryoRegistrar kryoRegistrar) Create an instance with a single KryoRegistrar.PojoCodec(@Nullable KryoRegistrar kryoRegistrar, boolean useReferences) Create an instance with a single KryoRegistrar. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureKryoInstance(com.esotericsoftware.kryo.Kryo kryo) Subclasses implement this to configure the kryo instance.protected <T> TdoDecode(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<T> type) Subclasses implement this method to decode with Kryo.protected voiddoEncode(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:AbstractKryoCodecSubclasses implement this method to encode with Kryo.- Specified by:
doEncodein 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:AbstractKryoCodecSubclasses implement this method to decode with Kryo.- Specified by:
doDecodein 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:AbstractKryoCodecSubclasses implement this to configure the kryo instance. This is invoked on each new Kryo instance when it is created.- Specified by:
configureKryoInstancein classAbstractKryoCodec- Parameters:
kryo- the Kryo instance
-