org.progeeks.util.beans
Class PropertyUtils

java.lang.Object
  extended by org.progeeks.util.beans.PropertyUtils

public class PropertyUtils
extends java.lang.Object

Utils for accessing or building ASTs for property expressions using a simple dot and index notation.

Examples:

foo.bar.baz:

foo.bar[12].baz:

foo\.bar[12].baz:

foo\\.bar[12].baz:

foo.bar\[12\].baz:

foo.bar[].baz:

Version:
$Revision: 1.9 $
Author:
Paul Speed

Field Summary
static SimpleExpressionLanguage EL
           
 
Constructor Summary
PropertyUtils()
           
 
Method Summary
static java.lang.Object getProperty(java.lang.Object bean, java.util.List expressionElements)
          Uses bean Introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the pre-parsed list of expression elements.
static java.lang.Object getProperty(java.lang.Object bean, java.lang.String expression)
          Uses bean Introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the string expression.
static java.util.List parseExpression(java.lang.String expression)
          Parses the expression and returns a list of elements found.
static void setProperty(java.lang.Object bean, java.util.List expressionElements, java.lang.Object value)
          Uses bean introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the string expression and set the last property in the chain.
static void setProperty(java.lang.Object bean, java.lang.String expression, java.lang.Object value)
          Uses bean introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the string expression and set the last property in the chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EL

public static final SimpleExpressionLanguage EL
Constructor Detail

PropertyUtils

public PropertyUtils()
Method Detail

parseExpression

public static java.util.List parseExpression(java.lang.String expression)
Parses the expression and returns a list of elements found. Otherwise, throws a RuntimeException.


getProperty

public static java.lang.Object getProperty(java.lang.Object bean,
                                           java.util.List expressionElements)
Uses bean Introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the pre-parsed list of expression elements. Returns the single value at the end of the chain. If the chain ends early then null is returned.


getProperty

public static java.lang.Object getProperty(java.lang.Object bean,
                                           java.lang.String expression)
Uses bean Introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the string expression. Returns the single value at the end of the chain. If the chain ends early then null is returned.


setProperty

public static void setProperty(java.lang.Object bean,
                               java.lang.String expression,
                               java.lang.Object value)
Uses bean introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the string expression and set the last property in the chain.


setProperty

public static void setProperty(java.lang.Object bean,
                               java.util.List expressionElements,
                               java.lang.Object value)
Uses bean introspection via org.progeeks.util.Inspector to access a sequence of nested properties specified by the string expression and set the last property in the chain.



Copyright © 2002-2003 Paul Speed. All Rights Reserved.