Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.syndication.feed.impl
Class EqualsBean  view EqualsBean download EqualsBean.java

java.lang.Object
  extended bycom.sun.syndication.feed.impl.EqualsBean
All Implemented Interfaces:
java.io.Serializable

public class EqualsBean
extends java.lang.Object
implements java.io.Serializable

Provides deep Bean equals() and hashCode() functionality for Java Beans.

It works on all read/write properties, recursively. It support all primitive types, Strings, Collections, bean-like objects and multi-dimensional arrays of any of them.

The hashcode is calculated by getting the hashcode of the Bean String representation.


Field Summary
private  java.lang.Class _beanClass
           
private  java.lang.Object _obj
           
private static java.lang.Object[] NO_PARAMS
           
 
Constructor Summary
protected EqualsBean(java.lang.Class beanClass)
          Default constructor.
  EqualsBean(java.lang.Class beanClass, java.lang.Object obj)
          Creates a EqualsBean to be used in a delegation pattern.
 
Method Summary
 boolean beanEquals(java.lang.Object obj)
          Indicates whether some other object is "equal to" the object passed in the constructor, as defined by the Object equals() method.
 int beanHashCode()
          Returns the hashcode for the object passed in the constructor.
private  boolean doEquals(java.lang.Object obj1, java.lang.Object obj2)
           
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this object as defined by the Object equals() method.
private  boolean equalsArray(java.lang.Object array1, java.lang.Object array2)
           
 int hashCode()
          Returns the hashcode for this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PARAMS

private static final java.lang.Object[] NO_PARAMS

_beanClass

private java.lang.Class _beanClass

_obj

private java.lang.Object _obj
Constructor Detail

EqualsBean

protected EqualsBean(java.lang.Class beanClass)
Default constructor.

To be used by classes extending EqualsBean only.


EqualsBean

public EqualsBean(java.lang.Class beanClass,
                  java.lang.Object obj)
Creates a EqualsBean to be used in a delegation pattern.

For example:

public class Foo implements FooI { private EqualsBean _equalsBean; public Foo() { _equalsBean = new EqualsBean(FooI.class); } public boolean equals(Object obj) { return _equalsBean.beanEquals(obj); } public int hashCode() { return _equalsBean.beanHashCode(); } }

Method Detail

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this object as defined by the Object equals() method.

To be used by classes extending EqualsBean. Although it works also for classes using EqualsBean in a delegation pattern, for correctness those classes should use the


beanEquals

public boolean beanEquals(java.lang.Object obj)
Indicates whether some other object is "equal to" the object passed in the constructor, as defined by the Object equals() method.

To be used by classes using EqualsBean in a delegation pattern,


hashCode

public int hashCode()
Returns the hashcode for this object.

It follows the contract defined by the Object hashCode() method.

The hashcode is calculated by getting the hashcode of the Bean String representation.

To be used by classes extending EqualsBean. Although it works also for classes using EqualsBean in a delegation pattern, for correctness those classes should use the


beanHashCode

public int beanHashCode()
Returns the hashcode for the object passed in the constructor.

It follows the contract defined by the Object hashCode() method.

The hashcode is calculated by getting the hashcode of the Bean String representation.

To be used by classes using EqualsBean in a delegation pattern,


doEquals

private boolean doEquals(java.lang.Object obj1,
                         java.lang.Object obj2)

equalsArray

private boolean equalsArray(java.lang.Object array1,
                            java.lang.Object array2)