|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.stripes.util.bean.BeanUtil
public class BeanUtil
Provides a simple way to manipulate properties and nested properties specified by complex
property expressions. It should be noted that while the interface to this class is simple it
will be more efficient to use PropertyExpressionEvaluation
directly if you plan
to call more than one of the methods in this class with the same exact expression.
Constructor Summary | |
---|---|
BeanUtil()
|
Method Summary | |
---|---|
static Class<?> |
getPropertyType(String expression,
Object bean)
Attempts to determine the type of the property specified by the property expression in the context of the supplied bean. |
static Object |
getPropertyValue(String expression,
Object bean)
Attempts to fetch the property specified by the property expression in the context of the supplied bean. |
static void |
setPropertyToNull(String expression,
Object bean)
Attempts to set the property to null or an equivalent value. |
static void |
setPropertyValue(String expression,
Object bean,
Object value)
Attempts to set the property specified by the property expression in the context of the supplied bean. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BeanUtil()
Method Detail |
---|
public static Class<?> getPropertyType(String expression, Object bean) throws ParseException, EvaluationException
expression
- an expression representing a property or nested/indexed propertybean
- the bean against which to evaluate the expression
getPropertyValue(String, Object)
were invoked with the same parameters
ParseException
- if the expression is invalid and cannot be parsed
EvaluationException
- if the expression is valid, but cannot be evaluated against
this beanpublic static Object getPropertyValue(String expression, Object bean) throws ParseException, EvaluationException
expression
- an expression representing a property or nested/indexed propertybean
- the bean against which to evaluate the expression
ParseException
- if the expression is invalid and cannot be parsed
EvaluationException
- if the expression is valid, but cannot be evaluated against
this beanpublic static void setPropertyValue(String expression, Object bean, Object value) throws ParseException, EvaluationException
expression
- an expression representing a property or nested/indexed propertybean
- the bean against which to evaluate the expressionvalue
- the value to be set for the property, may be null
ParseException
- if the expression is invalid and cannot be parsed
EvaluationException
- if the expression is valid, but cannot be evaluated against
this beanpublic static void setPropertyToNull(String expression, Object bean) throws ParseException, EvaluationException
expression
- an expression representing a property or nested/indexed propertybean
- the bean against which to evaluate the expression
ParseException
- if the expression is invalid and cannot be parsed
EvaluationException
- if the expression is valid, but cannot be evaluated against
this bean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |