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(@Nonnull String expression, @Nullable Object root) throws org.apache.maven.shared.utils.introspection.IntrospectionException
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 objectIntrospectionException
- if anypublic static Object evaluate(@Nonnull String expression, @Nullable Object root, boolean trimRootToken) throws org.apache.maven.shared.utils.introspection.IntrospectionException
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
- trim root token yes/no.IntrospectionException
- if anyCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.