org.ujoframework
Interface UjoProperty<UJO extends Ujo,VALUE>

All Superinterfaces:
java.lang.CharSequence
All Known Subinterfaces:
ListUjoProperty<UJO,ITEM>
All Known Implementing Classes:
BeanProperty, BeanPropertyList, FactoryProperty, FieldProperty, FieldPropertyList, ListProperty, PathProperty, Property, RelationToMany, RelationToOne, SortingProperty

public interface UjoProperty<UJO extends Ujo,VALUE>
extends java.lang.CharSequence

Ujo property is a property of Ujo object. Every real Ujo implementation (ArrayUjo, MapUjo, BeanUjo) have got its special implementation of an UjoProperty interface.
See a general information about current framework or see some implementations.

Author:
Pavel Ponec
See Also:
Ujo

Method Summary
<VALUE_PAR>
UjoProperty<UJO,VALUE_PAR>
add(UjoProperty<? extends VALUE,VALUE_PAR> property)
          Create new composite (indirect) instance.
 void copy(UJO from, UJO to)
          Copy a value from the first UJO object to second one.
 UjoProperty<UJO,VALUE> descending()
          Create new instance of an indirect property with the descending direction of sorting.
 boolean equals(UJO ujo, VALUE value)
          Returns true, if the property value equals to a parameter value.
 VALUE getDefault()
          Method returns a default value for substitution of the null value for the current property.
 int getIndex()
          Returns a property index or value -1 if the property index is not defined.
 java.lang.String getName()
          Returns a name of Property.
 java.lang.Class<VALUE> getType()
          Returns a class of the current property.
 VALUE getValue(UJO ujo)
          It is a basic method for getting an appropriate type safe value from an Ujo object.
 boolean isAscending()
          A flag for an ascending direction of sorting.
 boolean isDefault(UJO ujo)
          Indicates whether a parameter value of the ujo "equal to" this property default value.
 boolean isDirect()
          If the property is the direct property of the related UJO class then method returns the TRUE value.
 boolean isTypeOf(java.lang.Class type)
          Returns true if the property type is a type or subtype of the parameter class.
 VALUE of(UJO ujo)
          A shortcut for the method getValue(Ujo) .
 void setValue(UJO ujo, VALUE value)
          It is a basic method for setting an appropriate type safe value to an Ujo object.
 java.lang.String toString()
          Returns the name of Property.
 
Methods inherited from interface java.lang.CharSequence
charAt, length, subSequence
 

Method Detail

getName

java.lang.String getName()
Returns a name of Property.


getType

java.lang.Class<VALUE> getType()
Returns a class of the current property.


setValue

void setValue(UJO ujo,
              VALUE value)
It is a basic method for setting an appropriate type safe value to an Ujo object.
The method calls a method Ujo.writeValue(org.ujoframework.UjoProperty, java.lang.Object) always.

See Also:
Ujo.writeValue(org.ujoframework.UjoProperty, java.lang.Object)

getValue

VALUE getValue(UJO ujo)
It is a basic method for getting an appropriate type safe value from an Ujo object.
The method calls a method Ujo.writeValue(org.ujoframework.UjoProperty, java.lang.Object) always.
Note: this method replaces the value of null by default

Parameters:
ujo - If a NULL parameter is used then an exception NullPointerException is throwed.
Returns:
Returns a type safe value from the ujo object.
See Also:
Ujo.readValue(UjoProperty)

of

VALUE of(UJO ujo)
A shortcut for the method getValue(Ujo) .

See Also:
getValue(Ujo)

getIndex

int getIndex()
Returns a property index or value -1 if the property index is not defined.
The index is reasonable for an implementation an ArrayUjo class and the value is used is used
for a sorting of Properties in a method UjoManager.readProperties(Class type) .

See Also:
ArrayUjo, UjoManager.readProperties(Class)

getDefault

VALUE getDefault()
Method returns a default value for substitution of the null value for the current property. The feature is purposeful only if the default value is not null and a propert value is null .

See Also:
Ujo.readValue(UjoProperty)

isDefault

boolean isDefault(UJO ujo)
Indicates whether a parameter value of the ujo "equal to" this property default value.


equals

boolean equals(UJO ujo,
               VALUE value)
Returns true, if the property value equals to a parameter value. The property value can be null.

Parameters:
ujo - A basic Ujo.
value - Null value is supported.
Returns:
Accordance

isDirect

boolean isDirect()
If the property is the direct property of the related UJO class then method returns the TRUE value.
Note: Indirect (composite) properties are excluded from from function Ujo.readProperties() by default and these properties should not be sent to methods Ujo.writeValue() and Ujo.readValue().

Since:
0.81

isTypeOf

boolean isTypeOf(java.lang.Class type)
Returns true if the property type is a type or subtype of the parameter class.


isAscending

boolean isAscending()
A flag for an ascending direction of sorting. It is recommended that the default result was true.

Since:
0.85
See Also:
UjoComparator

descending

UjoProperty<UJO,VALUE> descending()
Create new instance of an indirect property with the descending direction of sorting.

Returns:
returns a new instance of the indirect UjoProperty
Since:
0.85
See Also:
isAscending(), UjoComparator

add

<VALUE_PAR> UjoProperty<UJO,VALUE_PAR> add(UjoProperty<? extends VALUE,VALUE_PAR> property)
Create new composite (indirect) instance.

Since:
0.92

copy

void copy(UJO from,
          UJO to)
Copy a value from the first UJO object to second one. A null value is not replaced by the default.


toString

java.lang.String toString()
Returns the name of Property.

Specified by:
toString in interface java.lang.CharSequence
Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.