Class VariableResolver
- java.lang.Object
-
- org.apache.solr.handler.dataimport.VariableResolver
-
public class VariableResolver extends Object
A set of nested maps that can resolve variables by namespaces. Variables are enclosed with a dollar sign then an opening curly brace, ending with a closing curly brace. Namespaces are delimited with '.' (period).
This class also has special logic to resolve evaluator calls by recognizing the reserved function namespace: dataimporter.functions.xxx
This class caches strings that have already been resolved from the current dih import.
This API is experimental and may change in the future.- Since:
- solr 1.3
-
-
Field Summary
Fields Modifier and Type Field Description static String
FUNCTIONS_NAMESPACE
static String
FUNCTIONS_NAMESPACE_SHORT
-
Constructor Summary
Constructors Constructor Description VariableResolver()
VariableResolver(Map<String,Object> defaults)
VariableResolver(Properties defaults)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNamespace(String name, Map<String,Object> newMap)
List<String>
getVariables(String expr)
void
removeNamespace(String name)
String
replaceTokens(String template)
Given a String with place holders, replace them with the value tokens.Object
resolve(String name)
Resolves a given value with a namevoid
setEvaluators(Map<String,Evaluator> evaluators)
-
-
-
Field Detail
-
FUNCTIONS_NAMESPACE
public static final String FUNCTIONS_NAMESPACE
- See Also:
- Constant Field Values
-
FUNCTIONS_NAMESPACE_SHORT
public static final String FUNCTIONS_NAMESPACE_SHORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VariableResolver
public VariableResolver()
-
VariableResolver
public VariableResolver(Properties defaults)
-
-
Method Detail
-
resolve
public Object resolve(String name)
Resolves a given value with a name- Parameters:
name
- the String to be resolved- Returns:
- an Object which is the result of evaluation of given name
-
replaceTokens
public String replaceTokens(String template)
Given a String with place holders, replace them with the value tokens.- Returns:
- the string with the placeholders replaced with their values
-
removeNamespace
public void removeNamespace(String name)
-
-