public class ExprLookup extends Object implements Lookup
     ExprLookup.Variables vars = new ExprLookup.Variables();
     vars.add(new ExprLookup.Variable("String", org.apache.commons.lang.StringUtils.class));
     vars.add(new ExprLookup.Variable("Util", new Utility("Hello")));
     vars.add(new ExprLookup.Variable("System", "Class:java.lang.System"));
     XMLConfiguration config = new XMLConfiguration(TEST_FILE);
     config.setLogger(log);
     ExprLookup lookup = new ExprLookup(vars);
     lookup.setConfiguration(config);
     String str = lookup.lookup("'$[element] ' + String.trimToEmpty('$[space.description]')");
 
 In the example above TEST_FILE contains xml that looks like:
 
 <configuration>
   <element>value</element>
   <space xml:space="preserve">
     <description xml:space="default">     Some text      </description>
   </space>
 </configuration>
 
 The result will be "value Some text".
 This lookup uses Apache Commons Jexl and requires that the dependency be added to any
 projects which use this.| Modifier and Type | Class and Description | 
|---|---|
static class  | 
ExprLookup.Variable
The key and corresponding object that will be made available to the
 JexlContext for use in expressions. 
 | 
static class  | 
ExprLookup.Variables
List wrapper used to allow the Variables list to be created as beans in
 DefaultConfigurationBuilder. 
 | 
| Constructor and Description | 
|---|
ExprLookup()
The default constructor. 
 | 
ExprLookup(ExprLookup.Variables list)
Constructor for use by applications. 
 | 
ExprLookup(ExprLookup.Variables list,
          String prefix,
          String suffix)
Constructor for use by applications. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
ConfigurationInterpolator | 
getInterpolator()
Returns the  
ConfigurationInterpolator used by this object. | 
ConfigurationLogger | 
getLogger()
Returns the logger used by this object. 
 | 
ExprLookup.Variables | 
getVariables()
Returns the list of Variables that are accessible within expressions. 
 | 
String | 
lookup(String var)
Evaluates the expression. 
 | 
void | 
setInterpolator(ConfigurationInterpolator interpolator)
Sets the  
ConfigurationInterpolator to be used by this object. | 
void | 
setLogger(ConfigurationLogger logger)
Sets the logger to be used by this object. 
 | 
void | 
setVariablePrefixMatcher(String prefix)
Set the prefix to use to identify subordinate expressions. 
 | 
void | 
setVariables(ExprLookup.Variables list)
Add the Variables that will be accessible within expressions. 
 | 
void | 
setVariableSuffixMatcher(String suffix)
Set the suffix to use to identify subordinate expressions. 
 | 
public ExprLookup()
public ExprLookup(ExprLookup.Variables list)
list - The list of objects to be accessible in expressions.public ExprLookup(ExprLookup.Variables list, String prefix, String suffix)
list - The list of objects to be accessible in expressions.prefix - The prefix to use for subordinate lookups.suffix - The suffix to use for subordinate lookups.public void setVariablePrefixMatcher(String prefix)
prefix - The String identifying the beginning of the expression.public void setVariableSuffixMatcher(String suffix)
suffix - The String identifying the end of the expression.public void setVariables(ExprLookup.Variables list)
list - The list of Variables.public ExprLookup.Variables getVariables()
public ConfigurationLogger getLogger()
Logpublic void setLogger(ConfigurationLogger logger)
logger - the Logpublic ConfigurationInterpolator getInterpolator()
ConfigurationInterpolator used by this object.ConfigurationInterpolatorpublic void setInterpolator(ConfigurationInterpolator interpolator)
ConfigurationInterpolator to be used by this object.interpolator - the ConfigurationInterpolator (may be
        null)Copyright © 2001–2020 The Apache Software Foundation. All rights reserved.