com.sun.syndication.common
Class ObjectBean

java.lang.Object
  extended bycom.sun.syndication.common.ObjectBean
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ToString
Direct Known Subclasses:
Category, Cloud, Content, DCSubject, Description, Enclosure, Entry, Generator, Guid, Image, Item, Link, Module, Person, Source, SyndCategory, SyndContent, SyndEntry, SyndFeed, SyndImage, TextInput, WireFeed

public class ObjectBean
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, ToString

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
See Also:
Serialized Form

Constructor Summary
protected ObjectBean(java.lang.Class beanClass)
          Default constructor.
 
Method Summary
 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.
 java.lang.String toString(java.lang.String prefix)
          Returns the String representation for the bean using a prefix.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectBean

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

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a deep 'bean' clone of the object.

Returns:
a clone of the object.
Throws:
java.lang.CloneNotSupportedException - thrown if an element of the object cannot be cloned.

equals

public boolean equals(java.lang.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 java.lang.String toString()
Returns the String representation for the object.

Returns:
String representation for the object.

toString

public java.lang.String toString(java.lang.String prefix)
Returns the String representation for the bean using a prefix.

This method is used by ToString implementations.

Specified by:
toString in interface ToString
Parameters:
prefix - prefix to use in the String representation.
Returns:
String representation for the bean using the given prefix.


Copyright © 2004 Sun Microsystems. All Rights Reserved.