org.ujoframework
Interface Ujo

Package class diagram package Ujo
All Known Subinterfaces:
UjoExt<UJO_IMPL>, UjoTextable
All Known Implementing Classes:
ArrayUjo, ArrayUjoExt, BeanUjo, BeanUjoExt, FactoryUjo, FactoryUjoExt, FieldUjo, FieldUjoExt, MapUjo, MapUjoExt, RegistrarUjo, RegistrarUjoExt, SuperUjo, SuperUjoExt, 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 MapProperty<Person, String > NAME = newProperty("Name", String.class);
  public static final MapProperty<Person, Boolean> MALE = newProperty("Male", Boolean.class);
  public static final MapProperty<Person, Double > CASH = newProperty("Cash", 0d);
    
  public void addCash(double cash) {
    double newCash = CASH.of(this) + cash;
    CASH.setValue(this, newCash);
  }
}

See Also:
UjoProperty

Method Summary
 boolean readAuthorization(UjoAction action, UjoProperty property, java.lang.Object value)
          Get an authorization of the property for different actions.
 UjoProperty[] 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(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(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(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

UjoProperty[] 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.

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 © 2007-2008 PPonec