org.ujoframework.implementation.map
Class MapUjo

java.lang.Object
  extended by org.ujoframework.extensions.AbstractUjo
      extended by org.ujoframework.implementation.map.MapUjo
All Implemented Interfaces:
java.io.Serializable, UjoCloneable, UjoTextable, Ujo
Direct Known Subclasses:
RegistrarUjo

public abstract class MapUjo
extends AbstractUjo
implements java.io.Serializable

This is a simple abstract implementation of Ujo.
Child implementation can use "public static final UjoProperty" 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 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);

 }
 

Author:
Pavel Ponec
See Also:
Property, Serialized Form

Constructor Summary
  MapUjo()
          Constructor
protected MapUjo(java.util.HashMap<UjoProperty,java.lang.Object> aData)
          Constructor
 
Method Summary
protected static
<UJO extends MapUjo,ITEM>
ListProperty<UJO,ITEM>
newListProperty(java.lang.String name, java.lang.Class<ITEM> type)
          A ListProperty Factory Method assigns a next property index.
static
<UJO extends MapUjo,VALUE>
Property<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 MapUjo,VALUE>
Property<UJO,VALUE>
newProperty(java.lang.String name, VALUE value)
          A Property Factory Method assigns a next property index.
static
<UJO extends MapUjo,VALUE>
Property<UJO,VALUE>
newProperty(UjoProperty p, int index)
          Returns a new instance of property where the default value is null.
protected static
<UJO extends MapUjo,ITEM>
ListProperty<UJO,ITEM>
newPropertyList(java.lang.String name, java.lang.Class<ITEM> type)
          Deprecated. Use newListProperty(...) instead of.
 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 Property.getValue(org.ujoframework.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 Property.setValue(org.ujoframework.Ujo, java.lang.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

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 Property.setValue(org.ujoframework.Ujo, java.lang.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.

Specified by:
writeValue in interface Ujo
Parameters:
property - Property must be a direct type only!
See Also:
Property.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 Property.getValue(org.ujoframework.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.

Specified by:
readValue in interface Ujo
Parameters:
property - Property must be a direct type only!
Returns:
Property value
See Also:
Property.getValue(Ujo)

newProperty

public static <UJO extends MapUjo,VALUE> Property<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 MapUjo,VALUE> Property<UJO,VALUE> newProperty(java.lang.String name,
                                                                            VALUE value)
A Property Factory Method assigns a next property index.


newProperty

public static <UJO extends MapUjo,VALUE> Property<UJO,VALUE> newProperty(UjoProperty p,
                                                                         int index)
Returns a new instance of property where the default value is null.


newListProperty

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


newPropertyList

protected static final <UJO extends MapUjo,ITEM> ListProperty<UJO,ITEM> newPropertyList(java.lang.String name,
                                                                                        java.lang.Class<ITEM> type)
Deprecated. Use newListProperty(...) instead of.

A ListProperty Factory Method assigns a next property index.



Copyright © 2010. All Rights Reserved.