Package  Use  Tree  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

 

jve.generated
Class PropertyHelper

java.lang.Object
  extended byjve.generated.PropertyHelper


public class PropertyHelper
extends java.lang.Object

This helper provide the details of resolving an Object/Property string into the final object.

For example:
Object=Foo, Property=address.zip will be resolved into Foo.getAddress().getZip()
Object=Foo, Property=null will be resolved into Foo

It serves as an element to be cached and thrown away when the underlying object changes.

Note: the object can not be a Collection or an array of Objects.


Field Summary
protected  java.beans.PropertyDescriptor[] descriptorsChain
           
protected  int nesting
           
protected  java.lang.Object[] objectsChain
           
protected  java.lang.String[] propertiesChain
           
protected  java.lang.String property
           
protected  java.lang.Object soureObject
           
protected  java.lang.Class type
           
 

Constructor Summary
PropertyHelper(ObjectReference val)
          Create a property helper for the given ObjectReference.
PropertyHelper(java.lang.Object o, java.lang.String prop)
          Create a property helper for the given object and property string.
 

Method Summary
protected  java.lang.Object getObject(int index)
          Get the object value for the property at the given index.
protected  java.beans.PropertyDescriptor getPropertyDescriptor(int index)
          The a property descriptor for a particular hop
 java.lang.Class getType()
          Get the type of the property for this PropertyHelper.
static java.lang.Class getType(java.lang.Class root, java.lang.String property)
          Get the type of the given dotted property, rooted from the given class.
 java.lang.Object getValue()
          Get the final value of the property (the last property in the dotted property value).
protected  java.lang.Object getValue(java.lang.Object bean, java.beans.PropertyDescriptor pd)
          Get the value of a property from a given bean
protected  void initialize(java.lang.Object b, java.lang.String p)
          This object could have been constructed using an ObjectReference that has not been populated yet.
 boolean isPrimitive()
          Check to see if the target property's type is a Java primitive type.
 boolean isReadOnly()
          Check to see if the target property is read only.
 void setValue(java.lang.Object val)
          Set the value of the target property to the given value.
protected  void setValue(java.lang.Object bean, java.beans.PropertyDescriptor pd, java.lang.Object value)
          Set the value of a property to a given bean
 java.lang.String toString()
           
 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

 

Field Detail

 

 

nesting

protected int nesting


 

 

objectsChain

protected java.lang.Object[] objectsChain


 

 

propertiesChain

protected java.lang.String[] propertiesChain


 

 

descriptorsChain

protected java.beans.PropertyDescriptor[] descriptorsChain


 

 

soureObject

protected java.lang.Object soureObject


 

 

property

protected java.lang.String property


 

 

type

protected java.lang.Class type

Constructor Detail

 

 

PropertyHelper

public PropertyHelper(java.lang.Object o,
                      java.lang.String prop)

Create a property helper for the given object and property string.

Parameters:
o - the target object
prop - the property on the target object. May be null.


 

 

PropertyHelper

public PropertyHelper(ObjectReference val)

Create a property helper for the given ObjectReference. The helper will be initialized with the ObjectReference's object and property values.

Parameters:
val - the referenced object to resolve.

Method Detail

 

 

initialize

protected void initialize(java.lang.Object b,
                          java.lang.String p)

This object could have been constructed using an ObjectReference that has not been populated yet. This method will lazily parse the ObjectReference.

Parameters:
b - the object the ObjectReference is bound to
p - the property to bind to


 

 

getPropertyDescriptor

protected java.beans.PropertyDescriptor getPropertyDescriptor(int index)

The a property descriptor for a particular hop

Parameters:
index - the index in the properties chain. i.e. bar in foo.bar.baz would be 1.
Returns:
the property descriptor for the property at the given index.


 

 

getValue

protected java.lang.Object getValue(java.lang.Object bean,
                                    java.beans.PropertyDescriptor pd)

Get the value of a property from a given bean

Parameters:
bean - the bean to target
pd - the descriptor of the target property
Returns:
the value retrieved by calling the get method of the property on the bean


 

 

setValue

protected void setValue(java.lang.Object bean,
                        java.beans.PropertyDescriptor pd,
                        java.lang.Object value)

Set the value of a property to a given bean

Parameters:
bean - the bean to target
pd - the descriptor for the target property
value - the value to set


 

 

getObject

protected java.lang.Object getObject(int index)

Get the object value for the property at the given index.

Parameters:
index - the property index in the dotted property
Returns:
the value of the given property


 

 

getValue

public java.lang.Object getValue()

Get the final value of the property (the last property in the dotted property value).

Returns:
the property's value


 

 

isReadOnly

public boolean isReadOnly()

Check to see if the target property is read only. It is read only if does not have a write (set) method.

Returns:
true if the property cannot be written, false otherwise.


 

 

isPrimitive

public boolean isPrimitive()

Check to see if the target property's type is a Java primitive type.

Returns:
true if it is a primitive type, false otherwise.


 

 

setValue

public void setValue(java.lang.Object val)

Set the value of the target property to the given value.

Parameters:
val - the value to set


 

 

toString

public java.lang.String toString()


 

 

getType

public static java.lang.Class getType(java.lang.Class root,
                                      java.lang.String property)

Get the type of the given dotted property, rooted from the given class.

Parameters:
root - the base class to retrieve the property from
property - the target property (may be dotted - foo.bar.baz)
Returns:
the type of the target property


 

 

getType

public java.lang.Class getType()
                        throws java.lang.IllegalStateException

Get the type of the property for this PropertyHelper.

Returns:
the type of the property.
Throws:
java.lang.IllegalStateException - if the property value is invalid.


Package  Use  Tree  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD