jpaul.Misc
Class IdentityWrapper<T>
java.lang.Object
jpaul.Misc.IdentityWrapper<T>
public class IdentityWrapper<T>
- extends java.lang.Object
IdentityWrapper
is useful when you want to assign some
information to each object, not to each class of equal objects. An
IdentityWrapper
is a wrapper around the original
object that redefines equals
and hashCode
to implement "equality as identity".
- Version:
- $Id: IdentityWrapper.java,v 1.3 2006/03/14 02:29:31 salcianu Exp $
- Author:
- Alexandru Salcianu - salcianu@alum.mit.edu
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
obj
public final T obj
IdentityWrapper
public IdentityWrapper(T obj)
- Creates a
IdentityWrapper
.
- Parameters:
obj
- Object to wrap.
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright 2005 Alexandru Salcianu - salcianu@alum.mit.edu