Save This Page
Home » xwork-2.1.1-src » com.opensymphony.xwork2.util » [javadoc | source]
com.opensymphony.xwork2.util
public class: TextParseUtil [javadoc | source]
java.lang.Object
   com.opensymphony.xwork2.util.TextParseUtil
Utility class for text parsing.
Nested Class Summary:
public static interface  TextParseUtil.ParsedValueEvaluator  A parsed value evaluator for {@link TextParseUtil}. It could be supplied by calling {@link TextParseUtil#translateVariables(char, String, ValueStack, Class, ParsedValueEvaluator)}.

By supplying this ParsedValueEvaluator, the parsed value (parsed against the value stack) value will be given to ParsedValueEvaluator to be evaluated before the translateVariable process goes on.

A typical use-case would be to have a custom ParseValueEvaluator to URL Encode the parsed value. 

Method from com.opensymphony.xwork2.util.TextParseUtil Summary:
commaDelimitedStringToSet,   translateVariables,   translateVariables,   translateVariables,   translateVariables,   translateVariables,   translateVariables
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.xwork2.util.TextParseUtil Detail:
 public static Set commaDelimitedStringToSet(String s) 
    Returns a set from comma delimted Strings.
 public static String translateVariables(String expression,
    ValueStack stack) 
    Converts all instances of ${...} in expression to the value returned by a call to ValueStack#findValue(java.lang.String) . If an item cannot be found on the stack (null is returned), then the entire variable ${...} is not displayed, just as if the item was on the stack but returned an empty string.
 public static String translateVariables(String expression,
    ValueStack stack,
    TextParseUtil.ParsedValueEvaluator evaluator) 
    Function similarly as #translateVariables(char, String, ValueStack) except for the introduction of an additional evaluator that allows the parsed value to be evaluated by the evaluator. The evaluator could be null, if it is it will just be skipped as if it is just calling #translateVariables(char, String, ValueStack) .

    A typical use-case would be when we need to URL Encode the parsed value. To do so we could just supply a URLEncodingEvaluator for example.

 public static String translateVariables(char open,
    String expression,
    ValueStack stack) 
    Converts all instances of ${...} in expression to the value returned by a call to ValueStack#findValue(java.lang.String) . If an item cannot be found on the stack (null is returned), then the entire variable ${...} is not displayed, just as if the item was on the stack but returned an empty string.
 public static Object translateVariables(char open,
    String expression,
    ValueStack stack,
    Class asType) 
    Converted object from variable translation.
 public static Object translateVariables(char open,
    String expression,
    ValueStack stack,
    Class asType,
    TextParseUtil.ParsedValueEvaluator evaluator) 
    Converted object from variable translation.
 public static Object translateVariables(char open,
    String expression,
    ValueStack stack,
    Class asType,
    TextParseUtil.ParsedValueEvaluator evaluator,
    int maxLoopCount) 
    Converted object from variable translation.