Interface Copier<T>

  • Type Parameters:
    T - the type of the instance to copy

    public interface Copier<T>
    Defines the contract used to copy type instances.

    The copied object's class must be preserved. The following must always be true:

    object.getClass().equals( myCopier.copyForRead(object).getClass() ) object.getClass().equals( myCopier.copyForWrite(object).getClass() )

    • Method Detail

      • copyForRead

        T copyForRead​(T obj)
        Creates a copy of the instance passed in.

        This method is invoked as a value is read from the cache.

        Parameters:
        obj - the instance to copy
        Returns:
        the copy of the obj instance
      • copyForWrite

        T copyForWrite​(T obj)
        Creates a copy of the instance passed in.

        This method is invoked as a value is written to the cache.

        Parameters:
        obj - the instance to copy
        Returns:
        the copy of the obj instance