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 Summary

    Modifier and Type
    Method
    Description
    Creates a copy of the instance passed in.
    Creates a copy of the instance passed in.
  • Method Details

    • 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