org.vizzini.util
Class AbstractBean

java.lang.Object
  extended by org.vizzini.util.AbstractBean
Direct Known Subclasses:
AbstractArgument, AbstractConnector, AbstractLayer, AbstractSentence, Filter, HighlightData

public abstract class AbstractBean
extends Object

Provides an abstract data bean. This class supplies useful methods like equals(), hashCode(), and toString() to speed development of subclasses.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson

Field Summary
protected static Set IGNORE_PROPERTIES
          Properties to ignore when executing toString().
 
Constructor Summary
AbstractBean()
           
 
Method Summary
protected  void appendArray(StringBuffer sb, String title, Class componentType, Object value, String indent)
          Append the given list items to the given string buffer, using the given title.
protected  void appendCollection(StringBuffer sb, String title, Collection collection, String indent)
          Append the given collection items to the given string buffer, using the given title.
protected  void appendList(StringBuffer sb, String title, List list, String indent)
          Append the given list items to the given string buffer, using the given title.
protected  void appendMap(StringBuffer sb, String title, Map map, String indent)
          Append the given map items to the given string buffer, using the given title.
protected  boolean compareBooleans(boolean boolean1, boolean boolean2)
          Compare the given booleans, returning true if they are equal, false otherwise.
protected  boolean compareObjects(Object object1, Object object2)
          Compare the given objects, returning true if they are equal, false otherwise.
 boolean equals(Object object)
          Return true if the given object is equal to this.
protected  Set getIgnoreProperties()
          Return the set of property names to ignore in the toString() method.
 int hashCode()
          Return a hash code.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IGNORE_PROPERTIES

protected static final Set IGNORE_PROPERTIES
Properties to ignore when executing toString().

Constructor Detail

AbstractBean

public AbstractBean()
Method Detail

equals

public boolean equals(Object object)
Return true if the given object is equal to this. This method uses reflection to compare all the property values of this bean and the given object.

Overrides:
equals in class Object
Parameters:
object - The object to compare equality against.
Returns:
Returns true if the objects are equal, otherwise false
Since:
v0.2

hashCode

public int hashCode()
Return a hash code. This method uses reflection to create a string of all the property values of this bean.

Overrides:
hashCode in class Object
Since:
v0.2

toString

public String toString()
Return a string representation of this object. This method uses reflection to access all the properties of the bean. Property names in the set IGNORE_PROPERTIES are ignored.

Overrides:
toString in class Object
Since:
v0.2

appendArray

protected void appendArray(StringBuffer sb,
                           String title,
                           Class componentType,
                           Object value,
                           String indent)
Append the given list items to the given string buffer, using the given title.

Parameters:
sb - String buffer.
title - List title.
componentType - Array component type.
value - Value.
indent - Indent
Since:
v0.3

appendCollection

protected void appendCollection(StringBuffer sb,
                                String title,
                                Collection collection,
                                String indent)
Append the given collection items to the given string buffer, using the given title.

Parameters:
sb - String buffer.
title - Collection title.
collection - Collection
Since:
v0.2

appendList

protected void appendList(StringBuffer sb,
                          String title,
                          List list,
                          String indent)
Append the given list items to the given string buffer, using the given title.

Parameters:
sb - String buffer.
title - List title.
list - List.
Since:
v0.2

appendMap

protected void appendMap(StringBuffer sb,
                         String title,
                         Map map,
                         String indent)
Append the given map items to the given string buffer, using the given title.

Parameters:
sb - String buffer.
title - Map title.
map - Map.
Since:
v0.2

compareBooleans

protected boolean compareBooleans(boolean boolean1,
                                  boolean boolean2)
Compare the given booleans, returning true if they are equal, false otherwise.

Parameters:
boolean1 -
boolean2 -
Returns:
true if the booleans are equal, false otherwise.
Since:
v0.2

compareObjects

protected boolean compareObjects(Object object1,
                                 Object object2)
Compare the given objects, returning true if they are equal, false otherwise.

Parameters:
object1 -
object2 -
Returns:
true if the objects are equal, false otherwise.
Since:
v0.2

getIgnoreProperties

protected Set getIgnoreProperties()
Return the set of property names to ignore in the toString() method.

Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02