com.sun.syndication.feed.impl

Class ObjectBean

public class ObjectBean extends Object implements Serializable, Cloneable

Convenience class providing clone(), toString(), equals() and hashCode() functionality for Java Beans.

It works on all read/write properties, recursively.

It uses the CloneableBean, EqualsBean and ToStringBean classes in a delegation pattern.

ObjectBean programming conventions

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.

Author: Alejandro Abdelnur

Field Summary
CloneableBean_cloneableBean
EqualsBean_equalsBean
ToStringBean_toStringBean
Constructor Summary
ObjectBean(Class beanClass, Object obj)
Constructor.
ObjectBean(Class beanClass, Object obj, Set ignoreProperties)
Constructor.
Method Summary
Objectclone()
Creates a deep 'bean' clone of the object.
booleanequals(Object other)
Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
inthashCode()
Returns a hashcode value for the object.
StringtoString()
Returns the String representation for the object.

Field Detail

_cloneableBean

private CloneableBean _cloneableBean

_equalsBean

private EqualsBean _equalsBean

_toStringBean

private ToStringBean _toStringBean

Constructor Detail

ObjectBean

public ObjectBean(Class beanClass, Object obj)
Constructor.

Parameters: beanClass the class/interface to be used for property scanning.

ObjectBean

public ObjectBean(Class beanClass, Object obj, Set ignoreProperties)
Constructor.

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.

Parameters: beanClass the class/interface to be used for property scanning. ignoreProperties properties to ignore when cloning.

Method Detail

clone

public Object clone()
Creates a deep 'bean' clone of the object.

Returns: a clone of the object.

Throws: CloneNotSupportedException thrown if an element of the object cannot be cloned.

equals

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

Parameters: other he reference object with which to compare.

Returns: true if 'this' object is equal to the 'other' object.

hashCode

public int hashCode()
Returns a hashcode value for the object.

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

Returns: the hashcode of the bean object.

toString

public String toString()
Returns the String representation for the object.

Returns: String representation for the object.

Copyright © Sun Microsystems. All Rights Reserved.