Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.xwork2.util
Class TextParseUtil

    java.lang.Object
      com.opensymphony.xwork2.util.TextParseUtil

    public class TextParseUtil

extends Object

Utility class for text parsing.

Version:
  $Date: 2006-11-23 21:33:15 +0100 (Do, 23 Nov 2006) $ $Id: TextParseUtil.java 1223 2006-11-23 20:33:15Z rainerh $
Author:
  Jason Carreira, Rainer Hermanns, tm_jee

Nested Class Summary
`static interface` | `TextParseUtil.ParsedValueEvaluator` A parsed value evaluator for `TextParseUtil`.

Constructor Summary
`TextParseUtil()`

Method Summary
`static Set` | `commaDelimitedStringToSet(String s)` Returns a set from comma delimted Strings.
`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)`.
`static Object` | `translateVariables(char open, String expression, ValueStack stack, Class asType)` Converted object from variable translation.
`static Object` | `translateVariables(char open, String expression, ValueStack stack, Class asType, TextParseUtil.ParsedValueEvaluator evaluator)` Converted object from variable translation.
`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)`.
`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`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TextParseUtil

    public TextParseUtil()

Method Detail

### translateVariables

    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.

  Parameters:
    `expression` - an expression that hasn't yet been translated
  Returns:
    the parsed expression

### translateVariables

    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.

  Parameters:
    `expression` -
    `stack` -
    `evaluator` - The parsed Value evaluator (could be null).
  Returns:
    the parsed (and possibly evaluated) variable String.

### translateVariables

    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.

  Parameters:
    `open` -
    `expression` -
    `stack` -
  Returns:
    Translated variable String

### translateVariables

    public static Object translateVariables(char open,
                                            String expression,
                                            ValueStack stack,
                                            Class asType)

  Converted object from variable translation.

  Parameters:
    `open` -
    `expression` -
    `stack` -
    `asType` -
  Returns:
    Converted object from variable translation.

### translateVariables

    public static Object translateVariables(char open,
                                            String expression,
                                            ValueStack stack,
                                            Class asType,
                                            TextParseUtil.ParsedValueEvaluator evaluator)

  Converted object from variable translation.

  Parameters:
    `open` -
    `expression` -
    `stack` -
    `asType` -
    `evaluator` -
  Returns:
    Converted object from variable translation.

### commaDelimitedStringToSet

    public static Set commaDelimitedStringToSet(String s)

  Returns a set from comma delimted Strings.

  Parameters:
    `s` - The String to parse.
  Returns:
    A set from comma delimted Strings.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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