javax.cache.annotation
Interface CacheKey

All Superinterfaces:
Serializable

public interface CacheKey
extends Serializable

A Serializable, immutable, thread-safe object that is used as a cache key.

The implementation MUST follow the Java contract for Object.hashCode() and Object.equals(Object) to ensure correct behavior.

It is recommended that implementations also override Object.toString() and provide a human-readable string representation of the key.

Since:
1.0
Author:
Eric Dalquist
See Also:
CacheKeyGenerator

Method Summary
 boolean equals(Object o)
          Compare this CacheKey with another.
 int hashCode()
          The immutable hash code of the cache key.
 

Method Detail

hashCode

int hashCode()
The immutable hash code of the cache key.

Overrides:
hashCode in class Object
Returns:
The hash code of the object
See Also:
Object.hashCode()

equals

boolean equals(Object o)
Compare this CacheKey with another. If the two objects are equal their hashCode() values MUST be equal as well.

Overrides:
equals in class Object
Parameters:
o - The other object to compare to.
Returns:
true if the objects are equal
See Also:
Object.equals(Object)


Copyright © 2011. All Rights Reserved.