public class ObjectBean
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
It works on all read/write properties, recursively.
It uses the CloneableBean, EqualsBean and ToStringBean classes in a delegation pattern.
All ObjectBean subclasses having properties that return collections they should never return null if the property has been set to null or if a collection has not been set. They should create and return an empty collection, this empty collection instance should also be set to the corresponding property.
All ObjectBean subclasses properties should be live references.
Modifier and Type | Field and Description |
---|---|
private CloneableBean |
cloneableBean |
private EqualsBean |
equalsBean |
private static long |
serialVersionUID |
private ToStringBean |
toStringBean |
Constructor and Description |
---|
ObjectBean(java.lang.Class<?> beanClass,
java.lang.Object obj) |
ObjectBean(java.lang.Class<?> beanClass,
java.lang.Object obj,
java.util.Set<java.lang.String> ignoreProperties)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a deep 'bean' clone of the object.
|
boolean |
equals(java.lang.Object other)
Indicates whether some other object is "equal to" this one as defined by the Object equals()
method.
|
int |
hashCode()
Returns a hashcode value for the object.
|
java.lang.String |
toString()
Returns the String representation for the object.
|
private static final long serialVersionUID
private final EqualsBean equalsBean
private final ToStringBean toStringBean
private final CloneableBean cloneableBean
public ObjectBean(java.lang.Class<?> beanClass, java.lang.Object obj)
beanClass
- the class/interface to be used for property scanning.public ObjectBean(java.lang.Class<?> beanClass, java.lang.Object obj, java.util.Set<java.lang.String> ignoreProperties)
The property names in the ignoreProperties Set will not be copied into the cloned instance. This is useful for cases where the Bean has convenience properties (properties that are actually references to other properties or properties of properties). For example SyndFeed and SyndEntry beans have convenience properties, publishedDate, author, copyright and categories all of them mapped to properties in the DC Module.
beanClass
- the class/interface to be used for property scanning.ignoreProperties
- properties to ignore when cloning.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- thrown if an element of the object cannot be cloned.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- he reference object with which to compare.public int hashCode()
It follows the contract defined by the Object hashCode() method.
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object