Package org.opendaylight.yangtools.util
Class ForwardingIdentityObject<T>
java.lang.Object
com.google.common.collect.ForwardingObject
org.opendaylight.yangtools.util.ForwardingIdentityObject<T>
- Type Parameters:
T
- Type of wrapped object
- All Implemented Interfaces:
Delegator<T>
@Beta
@NonNullByDefault
public abstract class ForwardingIdentityObject<T>
extends ForwardingObject
implements Delegator<T>
A
ForwardingObject
which additionally masks hashCode()
/equals(Object)
of a delegate object,
so that it can be a data transfer object with data-dependent implementations of those contracts can be use in
collections and maps which need to work on identity. This is useful in situations where identity equality needs to
be used with the conjunction with the collections library, for example ConcurrentHashMap
. All instances are
considered equal if they refer to the same delegate object.
Note this class forms its own equality domain, and its use may lead to surprising results, especially where
ForwardingObject.toString()
is involved. For example a Map.toString()
may end up emitting two keys which have the
same String representation.
- Author:
- Robert Varga
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.google.common.collect.ForwardingObject
toString
-
Constructor Details
-
ForwardingIdentityObject
protected ForwardingIdentityObject()
-
-
Method Details
-
of
-
getDelegate
Description copied from interface:Delegator
Return underlying delegate.- Specified by:
getDelegate
in interfaceDelegator<T>
- Returns:
- underlying delegate.
-
hashCode
public final int hashCode() -
equals
-
delegate
- Specified by:
delegate
in classForwardingObject
-