Class SerializingCopier<T>

java.lang.Object
org.ehcache.impl.copy.ReadWriteCopier<T>
org.ehcache.impl.copy.SerializingCopier<T>
All Implemented Interfaces:
org.ehcache.spi.copy.Copier<T>

public final class SerializingCopier<T> extends ReadWriteCopier<T>
A helper copier implementation that performs the "copying" using serialization.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SerializingCopier(org.ehcache.spi.serialization.Serializer<T> serializer)
    Creates a new copier that will using the provided Serializer.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Class<? extends org.ehcache.spi.copy.Copier<T>>
    Convenience method allowing to represent this copier's class as the expected type in configuration.
    copy(T obj)
    Returns a copy of the passed in instance by serializing and deserializing it.
    org.ehcache.spi.serialization.Serializer<T>
    Returns the Serializer used by this copier.

    Methods inherited from class org.ehcache.impl.copy.ReadWriteCopier

    copyForRead, copyForWrite

    Methods inherited from class java.lang.Object

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

    • SerializingCopier

      public SerializingCopier(org.ehcache.spi.serialization.Serializer<T> serializer)
      Creates a new copier that will using the provided Serializer.
      Parameters:
      serializer - the serializer to use
  • Method Details

    • asCopierClass

      public static <T> Class<? extends org.ehcache.spi.copy.Copier<T>> asCopierClass()
      Convenience method allowing to represent this copier's class as the expected type in configuration.
      Type Parameters:
      T - The type to work on
      Returns:
      the proper type
    • copy

      public T copy(T obj)
      Returns a copy of the passed in instance by serializing and deserializing it.
      Specified by:
      copy in class ReadWriteCopier<T>
      Parameters:
      obj - the instance to copy
      Returns:
      a copied instance, depending on the implementation
    • getSerializer

      public org.ehcache.spi.serialization.Serializer<T> getSerializer()
      Returns the Serializer used by this copier.
      Returns:
      the serializer used