org.apache.solr.handler.dataimport
Class VariableResolver

java.lang.Object
  extended by 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
static String FUNCTIONS_NAMESPACE
           
static String FUNCTIONS_NAMESPACE_SHORT
           
 
Constructor Summary
VariableResolver()
           
VariableResolver(Map<String,Object> defaults)
           
VariableResolver(Properties defaults)
           
 
Method Summary
 void addNamespace(String name, Map<String,Object> newMap)
           
 List<String> getVariables(String template)
          Get a list of variables embedded in the template string.
 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 name
 void setEvaluators(Map<String,Evaluator> evaluators)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

VariableResolver

public VariableResolver(Map<String,Object> 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

getVariables

public List<String> getVariables(String template)
Get a list of variables embedded in the template string.


addNamespace

public void addNamespace(String name,
                         Map<String,Object> newMap)

removeNamespace

public void removeNamespace(String name)

setEvaluators

public void setEvaluators(Map<String,Evaluator> evaluators)


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.