org.ujoframework
Interface Ujo

All Known Subinterfaces:
ExtendedOrmUjo<UJO_IMPL>, OrmUjo, UjoExt<UJO_IMPL>, UjoMiddle<UJO_IMPL>, UjoTextable
All Known Implementing Classes:
AbstractMetaModel, AbstractUjo, AbstractUjoExt, ArrayUjo, ArrayUjoExt, BeanUjo, BeanUjoExt, DbProcedure, FactoryUjo, FactoryUjoExt, FieldUjo, FieldUjoExt, MapImplUjo, MapImplUjoMiddle, MapUjo, MapUjoExt, MetaColumn, MetaDatabase, MetaIndex, MetaParams, MetaPKey, MetaProcedure, MetaRelation2Many, MetaRoot, MetaSelect, MetaTable, OrmTable, QuickUjo, QuickUjoMid, RegistrarUjo, RegistrarUjoExt, UjoPropertyRow

public interface Ujo

UJO Icons UJO means a Unified Java Object and its implementations provides a similar service like a JavaBeans class. Ujo is a basic inteface of the UJO Framework together with an interface UjoProperty .

Basic two methods are writeProperty(..) and readProperty(..) for a manipulation with a value; next method readAuthorization(..) recommends an authorizaton for a required action, selected Property and context; the last method returns all properties of current UJO object.

See a general prologue for more information or see some implementations.

The fastest way to use the interface is to extend an abstract parrent:

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, Double > CASH = newProperty("Cash", 0d);
    
  public void addCash(double cash) {
    double newCash = CASH.of(this) + cash;
    CASH.setValue(this, newCash);
  }
}

Author:
Pavel Ponec
See Also:
UjoProperty

Method Summary
 boolean readAuthorization(UjoAction action, UjoProperty property, java.lang.Object value)
          Get an authorization of the property for different actions.
 UjoPropertyList readProperties()
          Returns all direct properties.
 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 UjoProperty.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 UjoProperty.setValue(Ujo,Object) to an external access for a better type safe.
 

Method Detail

readValue

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 UjoProperty.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: A reaction on an incorrect property depends on the implementation.

Parameters:
property - Property must be a direct type only!
Returns:
Property value
See Also:
UjoProperty.getValue(org.ujoframework.Ujo), UjoProperty.isDirect()

writeValue

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 UjoProperty.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: A reaction on an incorrect property depends on the implementation.

Parameters:
property - Property must be a direct type only!
See Also:
UjoProperty.setValue(Ujo,Object), UjoProperty.isDirect()

readProperties

UjoPropertyList readProperties()
Returns all direct properties. There is recommended to be a "name" of each property is unique (but it is NOT a necessary condition). Two attributes with the same "name" must be demarked by a different ACTION_XML_ELEMENT authorization for a XML export.
An index property in the array UJO must be unique a continuous, an order of property array depends on an implementation of UJO object.

See Also:
UjoProperty.isDirect()

readAuthorization

boolean readAuthorization(UjoAction action,
                          UjoProperty property,
                          java.lang.Object value)
Get an authorization of the property for different actions.
There is recommended to return a true value for all actions by a default.
Note: An implemetace may return the original property array so it is possible to change some original property in the array from an extefnal code.

Parameters:
action - Type of request. See constant(s) UjoAction.ACTION_* for more information. The action must not be null, however there is allowed to use a dummy constant UjoAction.DUMMY.
property - A property of the Ujo
value - A property value
Returns:
Returns a TRUE value in case the property is authorized successfully.
See Also:
UjoAction


Copyright © 2010. All Rights Reserved.