org.ujoframework.implementation.factory
Class FactoryProperty<UJO extends Ujo,VALUE>

java.lang.Object
  extended by org.ujoframework.extensions.Property<UJO,VALUE>
      extended by org.ujoframework.implementation.factory.FactoryProperty<UJO,VALUE>
All Implemented Interfaces:
java.lang.CharSequence, ValueAgent<UJO,VALUE>, UjoProperty<UJO,VALUE>

public class FactoryProperty<UJO extends Ujo,VALUE>
extends Property<UJO,VALUE>
implements ValueAgent<UJO,VALUE>

A Factory property implementation.

Since:
ujo-tool
Author:
Pavel Ponec
See Also:
FactoryProperty

Field Summary
protected  java.lang.reflect.Constructor<VALUE> constructor
          Constructor
 
Constructor Summary
FactoryProperty(java.lang.String name, java.lang.Class<VALUE> type)
          Constructor
FactoryProperty(java.lang.String name, java.lang.Class<VALUE> type, int index)
          Constructor
 
Method Summary
static
<UJO extends Ujo,VALUE>
FactoryProperty<UJO,VALUE>
newInstance(java.lang.String name, java.lang.Class<VALUE> type)
          Returns a new instance of property where the default value is null.
static
<UJO extends Ujo,VALUE>
FactoryProperty<UJO,VALUE>
newInstance(java.lang.String name, java.lang.Class<VALUE> type, int index)
          Returns a new instance of property where the default value is null.
 VALUE readValue(UJO ujo)
          Create new Value.
protected  void throwException(java.lang.Throwable e)
          Throw an RuntimeException
 void writeValue(UJO ujo, VALUE value)
          The method os not implemented.
 
Methods inherited from class org.ujoframework.extensions.Property
_nextSequence, add, compareTo, copy, descending, equals, getDefault, getIndex, getName, getType, getValue, charAt, checkAttribs, init, isAscending, isDefault, isDirect, isTypeOf, length, newInstance, newInstance, newInstance, of, setValue, setValueFromDefault, subSequence, toString, writeDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constructor

protected final java.lang.reflect.Constructor<VALUE> constructor
Constructor

Constructor Detail

FactoryProperty

public FactoryProperty(java.lang.String name,
                       java.lang.Class<VALUE> type)
Constructor

Parameters:
name - The parameter MUST be a JavaBeans property name. The name will be used for building a Java reflection method name in a time of the first call.
type - Type of a JavaBeans setter input method or getter output method.

FactoryProperty

public FactoryProperty(java.lang.String name,
                       java.lang.Class<VALUE> type,
                       int index)
Constructor

Parameters:
name - The parameter MUST be a JavaBeans property name. The name will be used for building a Java reflection method name in a time of the first call.
type - Type of a JavaBeans setter input method or getter output method.
Method Detail

readValue

public VALUE readValue(UJO ujo)
                throws java.lang.IllegalArgumentException
Create new Value.
WARNING: There is recommended to call the method from the method Ujo.readProperty(...) only.
A direct call can bypass a important actions implemented in the readProperty(method).

Specified by:
readValue in interface ValueAgent<UJO extends Ujo,VALUE>
Throws:
java.lang.IllegalArgumentException

writeValue

public void writeValue(UJO ujo,
                       VALUE value)
                throws java.lang.IllegalArgumentException
The method os not implemented.
WARNING: There is recommended to call the method from the method Ujo.writeProperty(...) only.
A direct call can bypass a important actions implemented in the writeProperty(method).

Specified by:
writeValue in interface ValueAgent<UJO extends Ujo,VALUE>
Throws:
java.lang.IllegalArgumentException

throwException

protected void throwException(java.lang.Throwable e)
                       throws java.lang.RuntimeException
Throw an RuntimeException

Throws:
java.lang.RuntimeException

newInstance

public static <UJO extends Ujo,VALUE> FactoryProperty<UJO,VALUE> newInstance(java.lang.String name,
                                                                             java.lang.Class<VALUE> type,
                                                                             int index)
Returns a new instance of property where the default value is null.


newInstance

public static <UJO extends Ujo,VALUE> FactoryProperty<UJO,VALUE> newInstance(java.lang.String name,
                                                                             java.lang.Class<VALUE> type)
Returns a new instance of property where the default value is null.



Copyright © 2010. All Rights Reserved.