Top Description Fields Constructors Methods
org.eclipse.persistence.internal.identitymaps

public Class CacheId

extends Object
implements Serializable, Comparable<CacheId>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable, java.io.Serializable
Imports
java.io.*, java.util.Arrays, org.eclipse.persistence.internal.helper.*

Defines a wrapper for a primary key (Id) to use as a key in the cache.
Author
James Sutherland
Since
EclipseLink 2.1

Field Summary

Modifier and TypeField and Description
private static final CacheIdComparator
public static final CacheId
protected boolean
hasArray

Indicates whether at least one element of primaryKey is array.

protected int
hash

Cached hashcode.

protected Object[]
primaryKey

The primary key values.

Constructor Summary

AccessConstructor and Description
public
public
CacheId(Object[] primaryKey)

Method Summary

Modifier and TypeMethod and Description
public void
add(Object value)

Append the value to the end of the primary key values.

public int
compareTo(CacheId
the object to be compared.
otherId
)

Implements java.lang.Comparable.compareTo.

Determine if the receiver is greater or less than the key.
private int
computeArrayHashCode(int result, Object obj)

Compute the hashcode for supported array types.

protected int
computeHash(Object[] primaryKey)

Pre-compute the hash to optimize hash calls.

public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Determine if the receiver is equal to anObject.
public boolean
equals(CacheId id)

Determine if the receiver is equal to key.

public Object[]
public boolean
public int
hashCode()

Overrides java.lang.Object.hashCode.

Return the precomputed hashcode.
public void
set(int index, Object value)

Set the value in the primary key values.

public void
setPrimaryKey(Object[] primaryKey)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

COMPARATORback to summary
private static final CacheIdComparator COMPARATOR
EMPTYback to summary
public static final CacheId EMPTY
hasArrayback to summary
protected boolean hasArray

Indicates whether at least one element of primaryKey is array.

hashback to summary
protected int hash

Cached hashcode.

primaryKeyback to summary
protected Object[] primaryKey

The primary key values.

Constructor Detail

CacheIdback to summary
public CacheId()
CacheIdback to summary
public CacheId(Object[] primaryKey)

Method Detail

addback to summary
public void add(Object value)

Append the value to the end of the primary key values.

compareToback to summary
public int compareTo(CacheId otherId)

Implements java.lang.Comparable.compareTo.

Determine if the receiver is greater or less than the key.

Parameters
otherId:CacheId

Doc from java.lang.Comparable.compareTo.

the object to be compared.

Returns:int

Doc from java.lang.Comparable.compareTo.

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
computeArrayHashCodeback to summary
private int computeArrayHashCode(int result, Object obj)

Compute the hashcode for supported array types.

computeHashback to summary
protected int computeHash(Object[] primaryKey)

Pre-compute the hash to optimize hash calls.

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Determine if the receiver is equal to anObject. If anObject is a CacheKey, do further comparison, otherwise, return false.

Parameters
object:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
See Also
CacheKey#equals(CacheKey)
equalsback to summary
public boolean equals(CacheId id)

Determine if the receiver is equal to key. Use an index compare, because it is much faster than enumerations.

getPrimaryKeyback to summary
public Object[] getPrimaryKey()
hasArrayback to summary
public boolean hasArray()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Return the precomputed hashcode.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
setback to summary
public void set(int index, Object value)

Set the value in the primary key values.

setPrimaryKeyback to summary
public void setPrimaryKey(Object[] primaryKey)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override