java.lang.Object
org.eclipse.persistence.internal.identitymaps.CacheId
All Implemented Interfaces:
Serializable, Comparable<CacheId>

public class CacheId extends Object implements Serializable, Comparable<CacheId>
Defines a wrapper for a primary key (Id) to use as a key in the cache.
Since:
EclipseLink 2.1
See Also:
  • Field Details

    • EMPTY

      public static final CacheId EMPTY
    • primaryKey

      protected Object[] primaryKey
      The primary key values.
    • hash

      protected int hash
      Cached hashcode.
    • hasArray

      protected boolean hasArray
      Indicates whether at least one element of primaryKey is array.
  • Constructor Details

    • CacheId

      public CacheId()
    • CacheId

      public CacheId(Object[] primaryKey)
  • Method Details

    • getPrimaryKey

      public Object[] getPrimaryKey()
    • setPrimaryKey

      public void setPrimaryKey(Object[] primaryKey)
    • add

      public void add(Object value)
      Append the value to the end of the primary key values.
    • set

      public void set(int index, Object value)
      Set the value in the primary key values.
    • computeHash

      protected int computeHash(Object[] primaryKey)
      Pre-compute the hash to optimize hash calls.
    • hashCode

      public int hashCode()
      Return the precomputed hashcode.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Determine if the receiver is equal to anObject. If anObject is a CacheKey, do further comparison, otherwise, return false.
      Overrides:
      equals in class Object
      See Also:
    • equals

      public boolean equals(CacheId id)
      Determine if the receiver is equal to key. Use an index compare, because it is much faster than enumerations.
    • compareTo

      public int compareTo(CacheId otherId)
      Determine if the receiver is greater or less than the key.
      Specified by:
      compareTo in interface Comparable<CacheId>
    • hasArray

      public boolean hasArray()
    • toString

      public String toString()
      Overrides:
      toString in class Object