org.ujoframework.implementation.bean
Class BeanUjo

java.lang.Object
  extended by org.ujoframework.extensions.AbstractUjo
      extended by org.ujoframework.implementation.bean.BeanUjo
All Implemented Interfaces:
UjoCloneable, UjoTextable, Ujo

public abstract class BeanUjo
extends AbstractUjo

This abstract class is inteded for an easy implementation of UJO features to a completed JavaBean object.
A "name" of a BeanProperty is a JavaBean property name. By the "name" is deduced a setter and getter method name. The code syntax is Java 1.5 complied.

Features: an easy support of BEAN objects and the smallest memory footprint per one object.

Sample of usage

 import org.ujoframework.implementation.BEAN.*;
 public class Person extends BeanUjo {

    public static final UjoProperty<Person,String > NAME  = newProperty("name" , String.class);
    public static final UjoProperty<Person,Boolean> MALE  = newProperty("male" , Boolean.class);
    public static final UjoProperty<Person,Date   > BIRTH = newProperty("birth", Date.class);

    // ---- A STANDARD BEAN IMPLEMENTATION ----

    private String  name;
    private Boolean male;
    private Integer age ;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Boolean getMale() {
        return male;
    }
    public void setMale(Boolean male) {
        this.male = male;
    }
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
 }
 

Author:
Pavel Ponec
See Also:
BeanProperty

Constructor Summary
BeanUjo()
           
 
Method Summary
protected static
<UJO extends Ujo,ITEM>
BeanPropertyList<UJO,ITEM>
newListProperty(java.lang.String name, java.lang.Class<ITEM> type)
          A ListProperty Factory for a BeanUjo object.
protected static
<UJO extends Ujo,VALUE>
BeanProperty<UJO,VALUE>
newProperty(java.lang.String name, java.lang.Class<VALUE> type)
          Returns a new instance of property where the default value is null.
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.
 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.AbstractUjo
clone, 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
 

Constructor Detail

BeanUjo

public BeanUjo()
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)
Returns a new instance of property where the default value is null. Method assigns a next property index.


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. Method assigns a next property index.


newListProperty

protected static <UJO extends Ujo,ITEM> BeanPropertyList<UJO,ITEM> newListProperty(java.lang.String name,
                                                                                   java.lang.Class<ITEM> type)
A ListProperty Factory for a BeanUjo object. Method assigns a next property index.



Copyright © 2010. All Rights Reserved.