| |
|
| java.lang.Object scriptella.expression.PropertiesSubstitutor
PropertiesSubstitutor | public class PropertiesSubstitutor (Code) | | Substitutes properties(or expressions) in strings.
$ symbol indicate property or expression to evaluate and substitute.
The following properties/expression syntax is used:
Property reference
References named property.
Examples:
$foo
Expression.
Expression is wrapped by braces and evaluated by
Expression engine.
Examples:
${name+' '+surname} etc.
This class is not thread safe
author: Fyodor Kupolov version: 1.0 |
EXPR_PTR | final public static Pattern EXPR_PTR(Code) | | Expression pattern, e.g. ${property} etc.
|
PROP_PTR | final public static Pattern PROP_PTR(Code) | | Simple property patterns, e.g. $property
|
PropertiesSubstitutor | public PropertiesSubstitutor(ParametersCallback parameters)(Code) | | Creates a properties substitutor.
Parameters: parameters - parameters callback to use for substitution. |
PropertiesSubstitutor | public PropertiesSubstitutor(Map<String, ?> map)(Code) | | Creates a properties substitutor based on specified properties map.
Parameters: map - parameters to substitute. |
firstCandidate | static int firstCandidate(String string)(Code) | | |
hasProperties | public static boolean hasProperties(String string)(Code) | | Tests if the given string contains properties/expressions.
Parameters: string - string to check. true if a given string contains properties/expressions. |
setParameters | public void setParameters(ParametersCallback parameters)(Code) | | Sets parameters callback used for substitution.
Parameters: parameters - not null parameters callback. |
substitute | public String substitute(String s)(Code) | | Substitutes properties/expressions in s and returns the result string.
If result of evaluation is null or the property being substitued doesn't have value in callback - the whole
expressions is copied into result string as is.
Parameters: s - string to substitute. Null strings allowed. substituted string. |
substitute | public void substitute(Reader reader, Writer writer) throws IOException(Code) | | Copies content from reader to writer and expands properties.
Parameters: reader - reader to process. Parameters: writer - writer to output substituted content to. throws: IOException - if I/O error occurs. |
toString | protected String toString(Object o)(Code) | | Converts specified object to string.
Subclasses may provide custom conversion strategy here.
Parameters: o - object to convert to String. string representation of object. |
|
|
|