public class PropertyHelper extends Object
Helper class to provide access to the properties of JavaBeans. This implementation is stateless and maintains no cached information, so instances may be freely created and destroyed, with no side effects (unless there are side effects from caching inside the JDK itself).
$Id: PropertyHelper.java 464373 2006-10-16 04:21:54Z rahul $Constructor and Description |
---|
PropertyHelper() |
Modifier and Type | Method and Description |
---|---|
Class |
getType(Object bean,
String name)
Return the type of the specified property on the underlying bean
class.
|
Object |
getValue(Object bean,
String name)
Return the value of the specified property from the specified bean.
|
boolean |
isReadOnly(Object bean,
String name)
Return
true if the specified property is read only on
the underlying bean class. |
void |
setValue(Object bean,
String name,
Object value)
Set the specified value on the specified property of the specified
bean.
|
public Object getValue(Object bean, String name)
Return the value of the specified property from the specified bean.
bean
- Bean whose property is to be retrievedname
- Name of the property to getjavax.faces.el.PropertyNotFoundException
- if the bean class does not have
a property with the specified name, or if the property is write onlyjavax.faces.el.EvaluationException
- if an exception occurs while
retrieving the property valuepublic boolean isReadOnly(Object bean, String name)
Return true
if the specified property is read only on
the underlying bean class.
bean
- Bean whose property is to be checkedname
- Name of the property to checkjavax.faces.el.PropertyNotFoundException
- if the bean class does not have
a property with the specified name, or if the property is write onlyjavax.faces.el.EvaluationException
- if an exception occurs while
checking the read only statuspublic Class getType(Object bean, String name)
Return the type of the specified property on the underlying bean class.
bean
- Bean whose property is to be analyzedname
- Name of the property to return the type ofjavax.faces.el.PropertyNotFoundException
- if the bean class does not have
a property with the specified namejavax.faces.el.EvaluationException
- if an exception occurs while
retrieving the property typepublic void setValue(Object bean, String name, Object value)
Set the specified value on the specified property of the specified bean.
bean
- Bean whose property is to be setname
- Name of the property to be setvalue
- New value for this propertyjavax.faces.el.PropertyNotFoundException
- if the bean class does not have
a property with the specified name, or if the property is read onlyjavax.faces.el.EvaluationException
- if an exception occurs while
setting the property valueCopyright © 2004-2013 Apache Software Foundation. All Rights Reserved.