org.joda.beans.impl
Class BasicBean

java.lang.Object
  extended by org.joda.beans.impl.BasicBean
All Implemented Interfaces:
Bean
Direct Known Subclasses:
FlexiBean

public abstract class BasicBean
extends Object
implements Bean

Basic implementation of Bean intended for applications to subclass.

The subclass must to provide an implementation for Bean.metaBean(). This returns the complete definition of the bean at the meta level.


Constructor Summary
BasicBean()
           
 
Method Summary
 BasicBean clone()
          Clones this bean, returning an independent copy.
 boolean equals(Object obj)
          Checks if this bean equals another.
 int hashCode()
          Returns a suitable hash code.
<R> Property<R>
property(String propertyName)
          Gets a property by name.
 Set<String> propertyNames()
          Gets the set of property names.
 String toString()
          Returns a string that summarises the bean.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.beans.Bean
metaBean
 

Constructor Detail

BasicBean

public BasicBean()
Method Detail

property

public <R> Property<R> property(String propertyName)
Description copied from interface: Bean
Gets a property by name.

The base interface throws an exception if the name is not recognised. By contrast, the DynamicBean subinterface creates the property on demand.

Specified by:
property in interface Bean
Type Parameters:
R - the property type, optional, enabling auto-casting
Parameters:
propertyName - the property name to retrieve, not null
Returns:
the property, not null

propertyNames

public Set<String> propertyNames()
Description copied from interface: Bean
Gets the set of property names.

Specified by:
propertyNames in interface Bean
Returns:
the unmodifiable map of property objects, not null

clone

public BasicBean clone()
Clones this bean, returning an independent copy.

Specified by:
clone in interface Bean
Overrides:
clone in class Object
Returns:
the clone, not null

equals

public boolean equals(Object obj)
Checks if this bean equals another.

This compares the class and all the properties of the bean.

Overrides:
equals in class Object
Parameters:
obj - the object to compare to, null returns false
Returns:
true if the beans are equal

hashCode

public int hashCode()
Returns a suitable hash code.

The hash code is derived from all the properties of the bean.

Overrides:
hashCode in class Object
Returns:
a suitable hash code

toString

public String toString()
Returns a string that summarises the bean.

The string contains the class name and properties.

Overrides:
toString in class Object
Returns:
a summary string, not null


Copyright © 2007–2014 Joda.org. All rights reserved.