|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.SimpleExpressionLanguage
public class SimpleExpressionLanguage
Enables a simple expression language that can be used to access object properties through PropertyAccess implementations. The expression language is based on 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:
Nested Class Summary | |
---|---|
static interface |
SimpleExpressionLanguage.ExpressionElement
|
static class |
SimpleExpressionLanguage.IndexedExpressionElement
|
static class |
SimpleExpressionLanguage.NamedExpressionElement
|
Constructor Summary | |
---|---|
SimpleExpressionLanguage(PropertyAccess access)
|
Method Summary | |
---|---|
protected static java.lang.String |
createSyntaxErrorMessage(java.lang.String value,
int position)
|
java.lang.String |
elementsToString(java.util.List expressions)
Converts a list of ExpressionElements back to their unparsed form... basically, this is an "unparse" method. |
java.lang.Object |
getProperty(java.lang.Object object,
java.util.List expressionElements)
Uses a PropertyAccess object to access the value at the end of a sequence of nested properties specified by the pre-parsed list of expression elements. |
java.lang.Object |
getProperty(java.lang.Object object,
java.lang.String expression)
Uses a PropertyAccess object to access the value at the end of a sequence of nested properties specified by the string expression. |
java.lang.Class |
getPropertyClass(java.lang.Object object,
java.util.List expressionElements)
Uses a PropertyAccess object to access the property class at the end of a sequence of nested properties specified by the pre-parsed list of expression elements. |
java.lang.Class |
getPropertyClass(java.lang.Object object,
java.lang.String expression)
Uses a PropertyAccess object to access the property class at the end of a sequence of nested properties specified by the string expression. |
static void |
main(java.lang.String[] args)
For testing expression parsing as a command-line tool. |
java.util.List |
parseExpression(java.lang.String expression)
Parses the expression and returns a list of elements found. |
void |
setProperty(java.lang.Object object,
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. |
void |
setProperty(java.lang.Object object,
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 |
Constructor Detail |
---|
public SimpleExpressionLanguage(PropertyAccess access)
Method Detail |
---|
public java.util.List parseExpression(java.lang.String expression)
public java.lang.Object getProperty(java.lang.Object object, java.util.List expressionElements)
public java.lang.Object getProperty(java.lang.Object object, java.lang.String expression)
public java.lang.Class getPropertyClass(java.lang.Object object, java.util.List expressionElements)
public java.lang.Class getPropertyClass(java.lang.Object object, java.lang.String expression)
public void setProperty(java.lang.Object object, java.lang.String expression, java.lang.Object value)
public void setProperty(java.lang.Object object, java.util.List expressionElements, java.lang.Object value)
public java.lang.String elementsToString(java.util.List expressions)
String s =...; String t = elementsToString( parseExpression( s ) ); s.equals(t) should be true.
protected static java.lang.String createSyntaxErrorMessage(java.lang.String value, int position)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |