Package com.oracle.coherence.common.base
Class NaturalAssociator
java.lang.Object
com.oracle.coherence.common.base.NaturalAssociator
- All Implemented Interfaces:
Associator
- Direct Known Subclasses:
DefaultKeyAssociator
NaturalAssociator provides an Associator implementation for objects that
implement the
Associated
interface.- Author:
- gg 2012.03.11
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDetermine the host key (or base) object to which the specified object is associated.protected Object
validateAssociated
(Associated assoc) Check if given Associated object generates a circular association.
-
Constructor Details
-
NaturalAssociator
public NaturalAssociator()
-
-
Method Details
-
getAssociatedKey
Determine the host key (or base) object to which the specified object is associated.Note: It's expected that the returned object is suitable to be used as an immutable identity (e.g. a key in a Map).
Note 2: Circular associations are not permitted.- Specified by:
getAssociatedKey
in interfaceAssociator
- Parameters:
o
- the object to obtain an association for- Returns:
- the host key that for this object, or null if this object has no association
-
validateAssociated
Check if given Associated object generates a circular association.- Parameters:
assoc
- an Associated object to check- Returns:
- the key object that is associated with the specified object, or null if there is no association
- Throws:
RuntimeException
- if there is a circular key association chain, or if the maximum association depth has been reached
-