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.


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
 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).
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

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.