org.apache.solr.handler.dataimport
Class TemplateString

java.lang.Object
  extended by org.apache.solr.handler.dataimport.TemplateString

public class TemplateString
extends Object

Provides functionality for replacing variables in a templatized string. It can also be used to get the place-holders (variables) in a templatized string.

This API is experimental and may change in the future.

Since:
solr 1.3

Constructor Summary
TemplateString()
           
 
Method Summary
static List<String> getVariables(String s)
          Returns the variables in the given string.
 String replaceTokens(String string, VariableResolver resolver)
          Returns a string with all variables replaced by the known values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateString

public TemplateString()
Method Detail

replaceTokens

public String replaceTokens(String string,
                            VariableResolver resolver)
Returns a string with all variables replaced by the known values. An unknown variable is replaced by an empty string.

Parameters:
string - the String to be resolved
resolver - the VariableResolver instance to be used for evaluation
Returns:
the string with all variables replaced

getVariables

public static List<String> getVariables(String s)
Returns the variables in the given string.

Parameters:
s - the templatized string
Returns:
the list of variables (strings) in the given templatized string.


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