org.ujoframework.implementation.map
Class MapUjo

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

public abstract class MapUjo
extends AbstractUjo

This is a simple abstract implementation of Ujo.
Child implementation can use "public static final MapProperty" constants for its UjoProperties. 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
 
Fields inherited from class org.ujoframework.extensions.AbstractUjo
_propertyIndex
 
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 Method assigns a next property index.
protected static
<UJO extends Ujo,ITEM>
MapPropertyList<UJO,ITEM>
newPropertyList(java.lang.String name, java.lang.Class<ITEM> type)
          A PropertyList Factory Method assigns a next property index.
 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.AbstractUjo
_nextPropertyIndex, 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 final 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:
AbstractProperty.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:
AbstractProperty.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. Method assigns a next property index.


newProperty

protected static <UJO extends Ujo,VALUE> MapProperty<UJO,VALUE> newProperty(java.lang.String name,
                                                                            VALUE value)
A Property Factory Method assigns a next property index.


newPropertyList

protected static <UJO extends Ujo,ITEM> MapPropertyList<UJO,ITEM> newPropertyList(java.lang.String name,
                                                                                  java.lang.Class<ITEM> type)
A PropertyList Factory Method assigns a next property index.



Copyright © 2007-2009 PPonec