Class ObjectSerializer

java.lang.Object
org.mybatis.caches.ehcache.ObjectSerializer
All Implemented Interfaces:
org.ehcache.spi.serialization.Serializer<Object>

public class ObjectSerializer extends Object implements org.ehcache.spi.serialization.Serializer<Object>
Ehcache 3 Serializer that uses standard Java serialization. This serializer is required when off-heap or disk-based storage tiers are used, since those tiers cannot store object references directly.

Note: heap-only caches do not need serialization; this class is provided for configurations that add off-heap or disk tiers.

  • Constructor Details

    • ObjectSerializer

      public ObjectSerializer(ClassLoader loader)
      Constructor required by Ehcache 3's serializer contract.
      Parameters:
      loader - the class loader to use when deserialising objects
  • Method Details

    • serialize

      public ByteBuffer serialize(Object object) throws org.ehcache.spi.serialization.SerializerException
      Specified by:
      serialize in interface org.ehcache.spi.serialization.Serializer<Object>
      Throws:
      org.ehcache.spi.serialization.SerializerException
    • read

      public Object read(ByteBuffer binary) throws ClassNotFoundException, org.ehcache.spi.serialization.SerializerException
      Specified by:
      read in interface org.ehcache.spi.serialization.Serializer<Object>
      Throws:
      ClassNotFoundException
      org.ehcache.spi.serialization.SerializerException
    • equals

      public boolean equals(Object object, ByteBuffer binary) throws ClassNotFoundException, org.ehcache.spi.serialization.SerializerException
      Specified by:
      equals in interface org.ehcache.spi.serialization.Serializer<Object>
      Throws:
      ClassNotFoundException
      org.ehcache.spi.serialization.SerializerException