Class IdentityExtractor<T>

All Implemented Interfaces:
CanonicallyNamed, ExternalizableLite, PortableObject, QueryMapComparator, Remote.Function<T,T>, Remote.ToDoubleFunction<T>, Remote.ToIntFunction<T>, Remote.ToLongFunction<T>, ValueExtractor<T,T>, Serializable, Comparator, Function<T,T>, ToDoubleFunction<T>, ToIntFunction<T>, ToLongFunction<T>

public class IdentityExtractor<T> extends AbstractExtractor<T,T> implements ExternalizableLite, PortableObject
Trivial ValueExtractor implementation that does not actually extract anything from the passed value, but returns the value itself.
Since:
Coherence 3.2
Author:
jh/gg 2006.03.26
See Also:
  • Field Details

    • CANONICAL_NAME

      public static final String CANONICAL_NAME
      Canonical name for identity extractor.
      Since:
      12.2.1.4
      See Also:
    • INSTANCE

      public static final IdentityExtractor INSTANCE
      An instance of the IdentityExtractor.
  • Constructor Details

    • IdentityExtractor

      public IdentityExtractor()
      Default constructor (necessary for the ExternalizableLite interface).

      To obtain an instance of an IdentityExtractor use the IdentityExtractor.INSTANCE constant.

  • Method Details

    • extract

      public T extract(T target)
      Simply return the passed object.
      Specified by:
      extract in interface ValueExtractor<T,T>
      Overrides:
      extract in class AbstractExtractor<T,T>
      Parameters:
      target - the object to extract the value from
      Returns:
      the extracted value; null is an acceptable value
    • getCanonicalName

      public String getCanonicalName()
      Description copied from interface: ValueExtractor
      Return the canonical name for this extractor.

      A canonical name uniquely identifies what is to be extracted, but not how it is to be extracted. Thus two different extractor implementations with the same non-null canonical name are considered to be equal, and should reflect this in their implementations of hashCode and equals.

      Canonical names for properties are designated by their property name in camel case, for instance a Java Bean with method getFooBar would have a property named fooBar, and would have fooBar as its canonical name.

      Canonical names for zero-arg method invocations are the method name followed by ().

      Dots in a canonical name delimit one or more property/method accesses represented by a chaining ValueExtractor such as ChainedExtractor or PofExtractor(Class, PofNavigator, String).

      There is currently no canonical name format for methods which take parameters and as such they must return a canonical name of null.

      Specified by:
      getCanonicalName in interface CanonicallyNamed
      Specified by:
      getCanonicalName in interface ValueExtractor<T,T>
      Overrides:
      getCanonicalName in class AbstractExtractor<T,T>
      Returns:
      canonical name.
    • equals

      public boolean equals(Object o)
      Compare the IdentityExtractor with another object to determine equality.
      Specified by:
      equals in interface Comparator<T>
      Specified by:
      equals in interface ValueExtractor<T,T>
      Overrides:
      equals in class AbstractExtractor<T,T>
      Parameters:
      o - the reference object with which to compare
      Returns:
      true iff the passed object is an IdentityExtractor
    • hashCode

      public int hashCode()
      Return the hashCode of canonical name.
      Specified by:
      hashCode in interface ValueExtractor<T,T>
      Overrides:
      hashCode in class AbstractExtractor<T,T>
      Returns:
      an integer hash value for this IdentityExtractor object
    • toString

      public String toString()
      Provide a human-readable description of this IdentityExtractor object.
      Overrides:
      toString in class Object
      Returns:
      a human-readable description of this IdentityExtractor object
    • readExternal

      public void readExternal(DataInput in) throws IOException
      Restore the contents of this object by loading the object's state from the passed DataInput object.
      Specified by:
      readExternal in interface ExternalizableLite
      Parameters:
      in - the DataInput stream to read data from in order to restore the state of this object
      Throws:
      IOException - if an I/O exception occurs
    • writeExternal

      public void writeExternal(DataOutput out) throws IOException
      Save the contents of this object by storing the object's state into the passed DataOutput object.
      Specified by:
      writeExternal in interface ExternalizableLite
      Parameters:
      out - the DataOutput stream to write the state of this object to
      Throws:
      IOException - if an I/O exception occurs
    • readExternal

      public void readExternal(PofReader in) throws IOException
      Restore the contents of a user type instance by reading its state using the specified PofReader object.
      Specified by:
      readExternal in interface PortableObject
      Parameters:
      in - the PofReader from which to read the object's state
      Throws:
      IOException - if an I/O error occurs
    • writeExternal

      public void writeExternal(PofWriter out) throws IOException
      Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
      Specified by:
      writeExternal in interface PortableObject
      Parameters:
      out - the PofWriter to which to write the object's state
      Throws:
      IOException - if an I/O error occurs
    • INSTANCE

      public static <T> IdentityExtractor<T> INSTANCE()
      Return an instance of the IdentityExtractor.
      Type Parameters:
      T - the type of the value to extract
      Returns:
      a IdentityExtractor