Class IdentityWrapper<T>
java.lang.Object
fr.inria.rules.integraal.model.util.wrapper.IdentityWrapper<T>
- Type Parameters:
T- the type of the wrapped value
A utility wrapper that enforces the default identity‑based
hashCode
and equals semantics for the wrapped object. Use this class when you
need to place objects in hash‑based collections without being affected by
any custom overrides on the object’s class.
Equality checks are performed with == and the hash code is the one
returned by System.identityHashCode(Object), exactly mirroring
java.lang.Object's original contract.
-
Constructor Summary
ConstructorsConstructorDescriptionIdentityWrapper(T value) Creates an identity wrapper around the provided value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIdentity‑based equality.inthashCode()Identity‑based hash code.static <T> IdentityWrapper<T> of(T value) Factory method creating a newIdentityWrapperinstance.toString()Returns a string representation of this wrapper.unwrap()Returns the originally wrapped object.
-
Constructor Details
-
IdentityWrapper
Creates an identity wrapper around the provided value.- Parameters:
value- the value to wrap
-
-
Method Details
-
of
Factory method creating a newIdentityWrapperinstance.- Type Parameters:
T- the value type- Parameters:
value- the object to wrap, may benull- Returns:
- an
IdentityWrapperwrappingvalue
-
unwrap
-
hashCode
public int hashCode()Identity‑based hash code.- Overrides:
hashCodein classObject- Returns:
identityHashCodeof the wrapped value
-
equals
-
toString
-