org.kuali.rice.krad.uif.util
Class ObjectPropertyReference

java.lang.Object
  extended by org.kuali.rice.krad.uif.util.ObjectPropertyReference

public class ObjectPropertyReference
extends Object

Represents a property reference in a path expression, for use in implementing ObjectPathExpressionParser.PathEntry.

This class defers the actual resolution of property references nodes in a path expression until the transition between parse nodes. This facilitates traversal to the final node in the path.

Version:
2.4
Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
ObjectPathExpressionParser.parsePathExpression(Object, String, PathEntry)

Method Summary
 boolean canRead()
          Determine if the bean property is readable.
 boolean canWrite()
          Determine if the property is writable.
 Object get()
          Get the property value for a specific bean property of a known bean class.
 Object getBean()
          Get the bean.
 Class<?> getBeanClass()
          Get the bean class.
 Object getFromReadMethod()
          Get the property value for a specific bean property of a known bean class.
 Class<?> getImplClass()
          Get the bean implementation class.
 String getName()
          Get the property name.
 Class<?> getPropertyType()
          Get the type of a specific property on the implementation class.
static boolean isWarning()
          Determine if a warning should be logged on when an invalid property is encountered on the current thread.
static ObjectPropertyReference resolvePath(Object bean, Class<?> beanClass, String propertyPath, boolean grow)
          Resolve a path expression on a bean.
static ObjectPropertyReference resolveProperty(Object bean, Class<?> beanClass, String propertyPath)
          Get a single-use reference for resolving a property on a bean.
 void set(Object propertyValue)
          Set the property to a specific value.
static void setWarning(boolean warning)
          Indicate whether or not a warning should be logged on when an invalid property is encountered on the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWarning

public static boolean isWarning()
Determine if a warning should be logged on when an invalid property is encountered on the current thread.

Returns:
True to log warnings when invalid properties are encountered, false to ignore invalid properties.

setWarning

public static void setWarning(boolean warning)
Indicate whether or not a warning should be logged on when an invalid property is encountered on the current thread.

Parameters:
warning - True to log warnings when invalid properties are encountered, false to ignore invalid properties.

resolvePath

public static ObjectPropertyReference resolvePath(Object bean,
                                                  Class<?> beanClass,
                                                  String propertyPath,
                                                  boolean grow)
Resolve a path expression on a bean.

Parameters:
bean - The bean.
beanClass - The bean class.
propertyPath - The property path expression.
grow - True to create objects while traversing the path, false to traverse class structure only when referring to null.
Returns:
A reference to the final parse node involved in parsing the path expression.

resolveProperty

public static ObjectPropertyReference resolveProperty(Object bean,
                                                      Class<?> beanClass,
                                                      String propertyPath)
Get a single-use reference for resolving a property on a bean.

When using this method, the property name will be treated as-is, and will not be resolved as a path expression.

Parameters:
bean - The bean.
beanClass - The bean class.
propertyPath - The property path.
Returns:
A single-use reference to the final parse node involved in parsing the path expression. Note that the reference returned by this method will be reused and modified by the next call, so should not be set to a variable.

getBean

public Object getBean()
Get the bean.

Returns:
The bean

getBeanClass

public Class<?> getBeanClass()
Get the bean class.

The bean class may be a super-class of the bean, and is likely to be an abstract class or interface.

Returns:
The bean class. It is expected that the value returned by getBean() is either null, or that getBeanClass().isInstance(getBean()) will always return true.

getImplClass

public Class<?> getImplClass()
Get the bean implementation class.

Returns:
The the bean implementation class. The class returned by this method should always be the same class or a subclass of the class returned by getBeanClass(). When getBean() returns a non-null value it is expected that getBean(). getClass() == getImplClass().

getName

public String getName()
Get the property name.

Returns:
The property name.

canRead

public boolean canRead()
Determine if the bean property is readable.

Returns:
True if the property is readable, false if not.

canWrite

public boolean canWrite()
Determine if the property is writable.

Returns:
True if the property is writable, false if not.

getFromReadMethod

public Object getFromReadMethod()
Get the property value for a specific bean property of a known bean class.

Returns:
The property value for the specific bean property on the given bean.

get

public Object get()
Get the property value for a specific bean property of a known bean class.

Returns:
The property value for the specific bean property on the given bean.

getPropertyType

public Class<?> getPropertyType()
Get the type of a specific property on the implementation class.

Returns:
The type of the specific property on the implementation class.

set

public void set(Object propertyValue)
Set the property to a specific value.

Parameters:
propertyValue - The property value.


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.