org.ujoframework.implementation.quick
Class QuickUjo

java.lang.Object
  extended by org.ujoframework.extensions.AbstractUjo
      extended by org.ujoframework.implementation.quick.QuickUjo
All Implemented Interfaces:
java.io.Serializable, UjoCloneable, UjoTextable, Ujo
Direct Known Subclasses:
AbstractMetaModel, OrmTable, QuickUjoMid

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

This is a fast implementation of the Ujo. For implementation define only a "public static final UjoProperty" constants call a static method init() from the static block located after the latest property.
All properties must be objects (no primitive types) in the current version of UJO Framework.
Features: good performance, simple code.

Sample of usage

 import org.ujoframework.implementation.quick.*;
 public class Person extends QuickUjo {

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

    static {
        init(Person.class);
    }
 }

Author:
Pavel Ponec
See Also:
Property, Serialized Form

Constructor Summary
QuickUjo()
          Constructor
QuickUjo(java.lang.Object[] data)
          Constructor
 
Method Summary
protected static
<UJO extends Ujo,ITEM>
ListProperty<UJO,ITEM>
newListProperty(java.lang.Class<ITEM> itemType)
          A Property Factory creates new property and assigns a name and next property index.
protected static
<UJO extends Ujo,ITEM>
ListProperty<UJO,ITEM>
newListProperty(java.lang.String name, java.lang.Class<ITEM> itemType)
          A Property Factory creates new property and assigns a next property index.
protected static
<UJO extends Ujo,VALUE>
Property<UJO,VALUE>
newProperty(java.lang.Class<VALUE> type)
          A Property Factory creates new property and assigns a next property index.
protected static
<UJO extends Ujo,VALUE>
Property<UJO,VALUE>
newProperty(java.lang.String name, java.lang.Class<VALUE> type)
          A Property Factory creates new property and assigns a next property index.
protected static
<UJO extends Ujo,VALUE>
Property<UJO,VALUE>
newProperty(java.lang.String name, java.lang.Class<VALUE> type, VALUE defaultValue, int index, boolean lock)
          A Property Factory creates new property and assigns a next property index.
protected static
<UJO extends Ujo,VALUE>
Property<UJO,VALUE>
newProperty(java.lang.String name, VALUE value)
          A Property Factory creates new property and assigns a next property index.
static
<UJO extends QuickUjo,VALUE>
Property<UJO,VALUE>
newProperty(UjoProperty p)
          Returns a new instance of property where the default value is null.
protected static
<UJO extends Ujo,VALUE>
Property<UJO,VALUE>
newProperty(VALUE value)
          A Property Factory creates new property and 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 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

QuickUjo

public QuickUjo()
Constructor


QuickUjo

public QuickUjo(java.lang.Object[] data)
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 method can throws an ArrayIndexOutOfBoundsException.

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 can throws an ArrayIndexOutOfBoundsException.

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

newProperty

protected static <UJO extends Ujo,VALUE> Property<UJO,VALUE> newProperty(java.lang.String name,
                                                                         java.lang.Class<VALUE> type,
                                                                         VALUE defaultValue,
                                                                         int index,
                                                                         boolean lock)
A Property Factory creates new property and assigns a next property index.


newProperty

protected static <UJO extends Ujo,VALUE> Property<UJO,VALUE> newProperty(java.lang.String name,
                                                                         java.lang.Class<VALUE> type)
A Property Factory creates new property and assigns a next property index.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!


newProperty

protected static <UJO extends Ujo,VALUE> Property<UJO,VALUE> newProperty(java.lang.String name,
                                                                         VALUE value)
A Property Factory creates new property and assigns a next property index.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!


newProperty

protected static <UJO extends Ujo,VALUE> Property<UJO,VALUE> newProperty(java.lang.Class<VALUE> type)
A Property Factory creates new property and assigns a next property index.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!


newProperty

protected static <UJO extends Ujo,VALUE> Property<UJO,VALUE> newProperty(VALUE value)
A Property Factory creates new property and assigns a next property index.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!


newProperty

public static <UJO extends QuickUjo,VALUE> Property<UJO,VALUE> newProperty(UjoProperty p)
Returns a new instance of property where the default value is null.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!


newListProperty

protected static <UJO extends Ujo,ITEM> ListProperty<UJO,ITEM> newListProperty(java.lang.String name,
                                                                               java.lang.Class<ITEM> itemType)
A Property Factory creates new property and assigns a next property index.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!


newListProperty

protected static <UJO extends Ujo,ITEM> ListProperty<UJO,ITEM> newListProperty(java.lang.Class<ITEM> itemType)
A Property Factory creates new property and assigns a name and next property index.
Warning: Method does not lock the property so you must call AbstractUjo.init(..) method after initialization!



Copyright © 2010. All Rights Reserved.