org.ujoframework.implementation.bean
Class BeanUjoExt<UJO extends BeanUjoExt>

java.lang.Object
  extended by org.ujoframework.extensions.AbstractUjo
      extended by org.ujoframework.extensions.AbstractUjoExt<UJO>
          extended by org.ujoframework.implementation.bean.BeanUjoExt<UJO>
All Implemented Interfaces:
UjoCloneable, UjoExt<UJO>, UjoMiddle<UJO>, UjoTextable, Ujo

public abstract class BeanUjoExt<UJO extends BeanUjoExt>
extends AbstractUjoExt<UJO>

This is an Groovy style implementation of a setter and getter methods for an easier access for developpers, however the methods have got an weaker type control in compare to the MapUjo implementation.
Sample of usage:

public class Person extends MapUjoExt {

  public static final UjoProperty<Person, String > NAME = newProperty("Name" , String.class);
  public static final UjoProperty<Person, Double > CASH = newProperty("Cash" , Double.class);
  public static final UjoProperty<Person, Person> CHILD = newProperty("Child", Person.class);
    
  public void init() {
    set(NAME, "George");
    set(CHILD, new Person());
    set(CHILD, NAME, "Jane");
    set(CHILD, CASH, 200d);
        
    String name = get(CHILD, NAME);
    double cash = get(CHILD, CASH);
  }
}

Since:
UJO release 0.80
Author:
Pavel Ponec
See Also:
BeanProperty

Constructor Summary
BeanUjoExt()
           
 
Method Summary
protected static
<UJO extends Ujo,VALUE>
BeanProperty<UJO,VALUE>
newProperty(java.lang.String name, java.lang.Class<VALUE> type)
          A Property Factory
protected static
<UJO extends Ujo,VALUE>
BeanProperty<UJO,VALUE>
newProperty(java.lang.String name, VALUE value)
          A Property Factory, a property type is related from the default value.
protected static
<UJO extends Ujo,ITEM>
BeanPropertyList<UJO,ITEM>
newPropertyList(java.lang.String name, java.lang.Class<ITEM> type)
          A ListProperty Factory for a BeanUjo object
 java.lang.Object readValue(UjoProperty property)
          It is a common method for reading all object values, however there is strongly recomended to use a method BeanProperty.getValue(Ujo) to an external access for a better type safe.
 void writeValue(UjoProperty property, java.lang.Object value)
          It is a common method for writing all object values, however there is strongly recomended to use a method BeanProperty.setValue(Ujo,Object) to an external access for a better type safe.
 
Methods inherited from class org.ujoframework.extensions.AbstractUjoExt
add, clone, copyTo, copyTo, createPropertyList, equals, findProperty, get, get, get, get, getItemCount, getText, isDefault, list, remove, remove, set, set, set, set, setText
 
Methods inherited from class org.ujoframework.extensions.AbstractUjo
equals, init, init, readAuthorization, readProperties, readUjoManager, readValueString, toString, writeValueString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ujoframework.Ujo
readAuthorization, readProperties
 

Constructor Detail

BeanUjoExt

public BeanUjoExt()
Method Detail

writeValue

public void writeValue(UjoProperty property,
                       java.lang.Object value)
It is a common method for writing all object values, however there is strongly recomended to use a method BeanProperty.setValue(Ujo,Object) to an external access for a better type safe. The method have got a strategy place for an implementation of several listeners and validators.
NOTE: If property is an incorrect then method throws an IllegalArgumentException.

Parameters:
property - Property must be a direct type only!
See Also:
BeanProperty.setValue(Ujo,Object)

readValue

public java.lang.Object readValue(UjoProperty property)
It is a common method for reading all object values, however there is strongly recomended to use a method BeanProperty.getValue(Ujo) to an external access for a better type safe. The method have got a strategy place for an implementation of several listeners and convertors.
NOTE: If property is an incorrect then method throws an IllegalArgumentException.

Parameters:
property - Property must be a direct type only!
Returns:
Property value
See Also:
BeanProperty.getValue(Ujo)

newProperty

protected static <UJO extends Ujo,VALUE> BeanProperty<UJO,VALUE> newProperty(java.lang.String name,
                                                                             java.lang.Class<VALUE> type)
A Property Factory


newProperty

protected static <UJO extends Ujo,VALUE> BeanProperty<UJO,VALUE> newProperty(java.lang.String name,
                                                                             VALUE value)
A Property Factory, a property type is related from the default value.


newPropertyList

protected static <UJO extends Ujo,ITEM> BeanPropertyList<UJO,ITEM> newPropertyList(java.lang.String name,
                                                                                   java.lang.Class<ITEM> type)
A ListProperty Factory for a BeanUjo object



Copyright © 2010. All Rights Reserved.