public class ReflectionValueExtractor extends 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 Object |
evaluate(String expression,
Object root)
The implementation supports indexed, nested and mapped properties.
|
static Object |
evaluate(String expression,
Object root,
boolean trimRootToken)
The implementation supports indexed, nested and mapped properties.
|
public static Object evaluate(String expression, Object root) throws 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 objectException
- if anypublic static Object evaluate(String expression, Object root, boolean trimRootToken) throws 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 objecttrimRootToken
- root startException
- if anyCopyright © 2001–2022 The Apache Software Foundation. All rights reserved.