Package org.kuali.rice.krad.uif.util
Class ObjectPropertyReference
java.lang.Object
org.kuali.rice.krad.uif.util.ObjectPropertyReference
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:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead()Determine if the bean property is readable.booleancanWrite()Determine if the property is writable.get()Get the property value for a specific bean property of a known bean class.getBean()Get the bean.Class<?> Get the bean class.Get the property value for a specific bean property of a known bean class.Class<?> Get the bean implementation class.getName()Get the property name.Class<?> Get the type of a specific property on the implementation class.static booleanDetermine if a warning should be logged on when an invalid property is encountered on the current thread.static ObjectPropertyReferenceresolvePath(Object bean, Class<?> beanClass, String propertyPath, boolean grow) Resolve a path expression on a bean.static ObjectPropertyReferenceresolveProperty(Object bean, Class<?> beanClass, String propertyPath) Get a single-use reference for resolving a property on a bean.voidSet the property to a specific value.static voidsetWarning(boolean warning) Indicate whether or not a warning should be logged on when an invalid property is encountered on the current thread.
-
Method Details
-
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
Get the bean.- Returns:
- The bean
-
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 thatgetBeanClass().isInstance(getBean())will always return true.
-
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(). WhengetBean()returns a non-null value it is expected thatgetBean().getClass()==getImplClass().
-
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
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
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
Get the type of a specific property on the implementation class.- Returns:
- The type of the specific property on the implementation class.
-
set
Set the property to a specific value.- Parameters:
propertyValue- The property value.
-