javax.cache.interceptor
Class DefaultCacheKey

java.lang.Object
  extended by javax.cache.interceptor.DefaultCacheKey
All Implemented Interfaces:
Serializable, CacheKey

public class DefaultCacheKey
extends Object
implements CacheKey

Default cache key implementation. Keeps a reference to a copy of the entire parameter array from InvocationContext.getParameters() and uses Arrays.deepHashCode(Object[]) to implement hashCode() and Arrays.deepEquals(Object[], Object[]) to implement equals(Object)

Since:
1.7
Author:
Eric Dalquist
See Also:
Serialized Form

Constructor Summary
DefaultCacheKey(Object[] parameters)
          Constructs a default cache key
 
Method Summary
 boolean equals(Object obj)
          Compare this CacheKey with another.
 int hashCode()
          The immutable hash code of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCacheKey

public DefaultCacheKey(Object[] parameters)
Constructs a default cache key

Parameters:
parameters - the paramters to use
Method Detail

hashCode

public int hashCode()
Description copied from interface: CacheKey
The immutable hash code of the object.

Specified by:
hashCode in interface CacheKey
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Description copied from interface: CacheKey
Compare this CacheKey with another. If the two objects are equal their CacheKey.hashCode() values MUST be equal as well.

Specified by:
equals in interface CacheKey
Overrides:
equals in class Object
Parameters:
obj - The other object to compare to.
Returns:
true if the objects are equal


true