java.lang.Object
org.springframework.integration.codec.kryo.AbstractKryoCodec
org.springframework.integration.codec.kryo.PojoCodec
All Implemented Interfaces:
Codec
Direct Known Subclasses:
MessageCodec

public class PojoCodec extends AbstractKryoCodec
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
  • Constructor Details

    • PojoCodec

      public PojoCodec()
    • PojoCodec

      public PojoCodec(KryoRegistrar kryoRegistrar)
      Create an instance with a single KryoRegistrar.
      Parameters:
      kryoRegistrar - the registrar.
    • PojoCodec

      public PojoCodec(List<KryoRegistrar> kryoRegistrars)
      Create an instance with zero to many KryoRegistrars.
      Parameters:
      kryoRegistrars - a list KryoRegistrars.
    • PojoCodec

      public PojoCodec(KryoRegistrar kryoRegistrar, boolean useReferences)
      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

      public PojoCodec(List<KryoRegistrar> kryoRegistrars, boolean useReferences)
      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 class AbstractKryoCodec
      Parameters:
      kryo - the Kryo instance
      object - the object to encode
      output - 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 class AbstractKryoCodec
      Type Parameters:
      T - the type for decoded object
      Parameters:
      kryo - the Kryo instance
      input - the Kryo Input instance
      type - 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 class AbstractKryoCodec
      Parameters:
      kryo - the Kryo instance