org.ujoframework.implementation.map
Class MapUjo

Package class diagram package MapUjo
java.lang.Object
  extended by org.ujoframework.extensions.SuperUjo
      extended by org.ujoframework.implementation.map.MapUjo
All Implemented Interfaces:
UjoCloneable, UjoTextable, Ujo
Direct Known Subclasses:
RegistrarUjo

public abstract class MapUjo
extends SuperUjo

This is a simple abstract implementation of Ujo.
For implementation define only a "public static final MapProperty" constants in a child class. The code syntax is Java 1.5 complied.

Features: very simple implementaton and a sufficient performance for common tasks. The architecture is useful for a rare assignment of values in object too.

Sample of usage

 import org.ujoframework.implementation.map.*;
 public class Person extends MapUjo {

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

 }
 

See Also:
MapProperty

Field Summary
protected  java.util.HashMap<UjoProperty,java.lang.Object> data
          Object data
 
Constructor Summary
  MapUjo()
          Constructor
protected MapUjo(java.util.HashMap<UjoProperty,java.lang.Object> aData)
          Constructor
 
Method Summary
protected static
<UJO extends Ujo,VALUE>
MapProperty<UJO,VALUE>
newProperty(java.lang.String name, java.lang.Class<VALUE> type)
          A Property Factory, a default value is null.
protected static
<UJO extends Ujo,VALUE>
MapProperty<UJO,VALUE>
newProperty(java.lang.String name, VALUE value)
          A Property Factory
protected static
<UJO extends Ujo,ITEM>
MapPropertyList<UJO,ITEM>
newPropertyList(java.lang.String name, java.lang.Class<ITEM> type)
          A PropertyList Factory
 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 MapProperty.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 MapProperty.setValue(Ujo,Object) to an external access for a better type safe.
 
Methods inherited from class org.ujoframework.extensions.SuperUjo
clone, equals, readAuthorization, readProperties, readUjoManager, readValueString, toString, writeValueString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.util.HashMap<UjoProperty,java.lang.Object> data
Object data

Constructor Detail

MapUjo

public MapUjo()
Constructor


MapUjo

protected MapUjo(java.util.HashMap<UjoProperty,java.lang.Object> aData)
Constructor

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 MapProperty.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 no exception is throwed.

Parameters:
property - Property must be a direct type only!
See Also:
SuperProperty.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 MapProperty.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 returns a null value.

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

newProperty

protected static <UJO extends Ujo,VALUE> MapProperty<UJO,VALUE> newProperty(java.lang.String name,
                                                                            java.lang.Class<VALUE> type)
A Property Factory, a default value is null.


newProperty

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


newPropertyList

protected static <UJO extends Ujo,ITEM> MapPropertyList<UJO,ITEM> newPropertyList(java.lang.String name,
                                                                                  java.lang.Class<ITEM> type)
A PropertyList Factory



Copyright © 2007-2008 PPonec