|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.syndication.feed.impl.EqualsBean
public class EqualsBean
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.
Constructor Summary | |
---|---|
protected |
EqualsBean(Class beanClass)
Default constructor. |
|
EqualsBean(Class beanClass,
Object obj)
Creates a EqualsBean to be used in a delegation pattern. |
Method Summary | |
---|---|
boolean |
beanEquals(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. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this object as defined by the Object equals() method. |
int |
hashCode()
Returns the hashcode for this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected EqualsBean(Class beanClass)
To be used by classes extending EqualsBean only.
beanClass
- the class/interface to be used for property scanning.public EqualsBean(Class beanClass, Object obj)
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();
}
}
beanClass
- the class/interface to be used for property scanning.obj
- object bean to test equality.Method Detail |
---|
public boolean equals(Object obj)
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
equals
in class Object
obj
- he reference object with which to compare.
beanEquals method.
public boolean beanEquals(Object obj)
To be used by classes using EqualsBean in a delegation pattern,
obj
- he reference object with which to compare.
constructor.
public int hashCode()
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
hashCode
in class Object
beanHashCode method.
public int beanHashCode()
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,
constructor.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |