public class ReflectionValueExtractor
extends java.lang.Object
Using simple dotted expressions to extract the values from an Object instance,
For example we might want to extract a value like: project.build.sourceDirectory
The implementation supports indexed, nested and mapped properties similar to the JSP way.
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
evaluate(java.lang.String expression,
java.lang.Object root)
The implementation supports indexed, nested and mapped properties.
|
static java.lang.Object |
evaluate(java.lang.String expression,
java.lang.Object root,
boolean trimRootToken)
The implementation supports indexed, nested and mapped properties.
|
public static java.lang.Object evaluate(java.lang.String expression, java.lang.Object root) throws java.lang.Exception
The implementation supports indexed, nested and mapped properties.
(\\w+)\\[(\\d+)\\]
pattern, i.e. "user.addresses[1].street"(\\w+)\\((.+)\\)
pattern, i.e. "user.addresses(myAddress).street"expression
- not null expressionroot
- not null objectjava.lang.Exception
- if anypublic static java.lang.Object evaluate(java.lang.String expression, java.lang.Object root, boolean trimRootToken) throws java.lang.Exception
The implementation supports indexed, nested and mapped properties.
(\\w+)\\[(\\d+)\\]
pattern, i.e. "user.addresses[1].street"(\\w+)\\((.+)\\)
pattern, i.e. "user.addresses(myAddress).street"expression
- not null expressionroot
- not null objectjava.lang.Exception
- if any