net.sf.japaki.beans
Class AbstractGenericBean<B extends GenericBean<B>>

java.lang.Object
  extended by net.sf.japaki.beans.AbstractGenericBean<B>
All Implemented Interfaces:
GenericBean<B>
Direct Known Subclasses:
BeanParserBean, ChoiceParserBean, ConstantParserBean, FixedParserBean, LeafParserBean, OptionalParserBean, PhraseBean

public abstract class AbstractGenericBean<B extends GenericBean<B>>
extends Object
implements GenericBean<B>

Since a "normal" bean would require a new class for each of its properties, a generic bean provides a getValue and a setValue method to access all its properties with an instance of GenericProperty. A public default constructor is expected.


Nested Class Summary
protected static class AbstractGenericBean.GenericProperty<B extends AbstractGenericBean,V>
          Property implementation for AbstractGenericBean based on getValue and setValue.
 
Constructor Summary
AbstractGenericBean()
           
 
Method Summary
 boolean equals(Object obj)
           
abstract  List<Property<? super B,?>> getProperties()
          Return a list of all properties of this bean.
protected abstract  Object getValue(Property property)
          Implementation of the getValue method of all properties of this bean.
 int hashCode()
           
protected abstract  void setValue(Property property, Object value)
          Implementation of the setValue method of all properties of this bean.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractGenericBean

public AbstractGenericBean()
Method Detail

getValue

protected abstract Object getValue(Property property)
Implementation of the getValue method of all properties of this bean. This method should not be called directly, use AbstractGenericBean.GenericProperty.getValue(B) instead.

Throws:
IllegalArgumentException - if the property does not belong to this bean

setValue

protected abstract void setValue(Property property,
                                 Object value)
Implementation of the setValue method of all properties of this bean. This method should not be called directly, use AbstractGenericBean.GenericProperty.setValue(B, V) instead.

Throws:
IllegalArgumentException - if the property does not belong to this bean

getProperties

public abstract List<Property<? super B,?>> getProperties()
Description copied from interface: GenericBean
Return a list of all properties of this bean.

Specified by:
getProperties in interface GenericBean<B extends GenericBean<B>>
Returns:
a list of all properties of this bean

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object