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
  • Field Summary

    Fields inherited from class org.springframework.integration.codec.kryo.AbstractKryoCodec

    pool
  • Constructor Summary

    Constructors 
    Constructor Description
    PojoCodec()  
    PojoCodec​(java.util.List<KryoRegistrar> kryoRegistrars)
    Create an instance with zero to many KryoRegistrars.
    PojoCodec​(java.util.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 Type Method Description
    protected 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, java.lang.Class<T> type)
    Subclasses implement this method to decode with Kryo.
    protected void doEncode​(com.esotericsoftware.kryo.Kryo kryo, java.lang.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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PojoCodec

      public PojoCodec()
    • PojoCodec

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

      public PojoCodec​(java.util.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​(java.util.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, java.lang.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, java.lang.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