[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Proxy Object override methods

adrian@jboss.org do-not-reply at jboss.com
Thu Dec 21 09:28:36 EST 2006


I've fixed a problem whether the proxy factory wasn't implement equals/hashCode/toString
properly when you used java.lang.Object as the parent.

The changes can be most easily seen from the new methods in the ProxyTemplate code


  |    public boolean equals(Object obj)
  |    {
  |       if (delegate != null)
  |       {
  |          if (obj != null && obj instanceof Delegate)
  |             obj = ((Delegate) obj).getDelegate();
  |          return delegate.equals(obj);
  |       }
  |       else
  |          return super.equals(obj);
  |    }
  |    
  |    public int hashCode()
  |    {
  |       if (delegate != null)
  |          return delegate.hashCode();
  |       else
  |          return super.hashCode();
  |    }
  |    
  |    public String toString()
  |    {
  |       if (delegate != null)
  |          return delegate.toString();
  |       else
  |          return super.toString();
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995605#3995605

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995605



More information about the jboss-dev-forums mailing list