Class CacheId
- java.lang.Object
-
- org.eclipse.persistence.internal.identitymaps.CacheId
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CacheId>
public class CacheId extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<CacheId>
Defines a wrapper for a primary key (Id) to use as a key in the cache.- Since:
- EclipseLink 2.1
- Author:
- James Sutherland
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static CacheIdEMPTYprotected booleanhasArrayIndicates whether at least one element of primaryKey is array.protected inthashCached hashcode.protected java.lang.Object[]primaryKeyThe primary key values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.Object value)Append the value to the end of the primary key values.intcompareTo(CacheId otherId)Determine if the receiver is greater or less than the key.protected intcomputeHash(java.lang.Object[] primaryKey)Pre-compute the hash to optimize hash calls.booleanequals(java.lang.Object object)Determine if the receiver is equal to anObject.booleanequals(CacheId id)Determine if the receiver is equal to key.java.lang.Object[]getPrimaryKey()booleanhasArray()inthashCode()Return the precomputed hashcode.voidset(int index, java.lang.Object value)Set the value in the primary key values.voidsetPrimaryKey(java.lang.Object[] primaryKey)java.lang.StringtoString()
-
-
-
Field Detail
-
EMPTY
public static final CacheId EMPTY
-
primaryKey
protected java.lang.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.
-
-
Method Detail
-
getPrimaryKey
public java.lang.Object[] getPrimaryKey()
-
setPrimaryKey
public void setPrimaryKey(java.lang.Object[] primaryKey)
-
add
public void add(java.lang.Object value)
Append the value to the end of the primary key values.
-
set
public void set(int index, java.lang.Object value)Set the value in the primary key values.
-
computeHash
protected int computeHash(java.lang.Object[] primaryKey)
Pre-compute the hash to optimize hash calls.
-
hashCode
public int hashCode()
Return the precomputed hashcode.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
Determine if the receiver is equal to anObject. If anObject is a CacheKey, do further comparison, otherwise, return false.- Overrides:
equalsin classjava.lang.Object- See Also:
CacheKey.equals(CacheKey)
-
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:
compareToin interfacejava.lang.Comparable<CacheId>
-
hasArray
public boolean hasArray()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-