org.apache.shale.util
Class PropertyHelper

java.lang.Object
  extended by org.apache.shale.util.PropertyHelper

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 $

Since:
1.0.1

Constructor Summary
PropertyHelper()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyHelper

public PropertyHelper()
Method Detail

getValue

public Object getValue(Object bean,
                       String name)

Return the value of the specified property from the specified bean.

Parameters:
bean - Bean whose property is to be retrieved
name - Name of the property to get
Throws:
javax.faces.el.PropertyNotFoundException - if the bean class does not have a property with the specified name, or if the property is write only
javax.faces.el.EvaluationException - if an exception occurs while retrieving the property value

isReadOnly

public boolean isReadOnly(Object bean,
                          String name)

Return true if the specified property is read only on the underlying bean class.

Parameters:
bean - Bean whose property is to be checked
name - Name of the property to check
Throws:
javax.faces.el.PropertyNotFoundException - if the bean class does not have a property with the specified name, or if the property is write only
javax.faces.el.EvaluationException - if an exception occurs while checking the read only status

getType

public Class getType(Object bean,
                     String name)

Return the type of the specified property on the underlying bean class.

Parameters:
bean - Bean whose property is to be analyzed
name - Name of the property to return the type of
Throws:
javax.faces.el.PropertyNotFoundException - if the bean class does not have a property with the specified name
javax.faces.el.EvaluationException - if an exception occurs while retrieving the property type

setValue

public void setValue(Object bean,
                     String name,
                     Object value)

Set the specified value on the specified property of the specified bean.

Parameters:
bean - Bean whose property is to be set
name - Name of the property to be set
value - New value for this property
Throws:
javax.faces.el.PropertyNotFoundException - if the bean class does not have a property with the specified name, or if the property is read only
javax.faces.el.EvaluationException - if an exception occurs while setting the property value


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.