com.ibm.xsp.util
Class ValueBindingUtil

java.lang.Object
  extended by com.ibm.xsp.util.ValueBindingUtil

public class ValueBindingUtil
extends java.lang.Object

The utility used for parsing ValueBindings and MethodBinding s. Generally users should use Application.createValueBinding(String) instead. This util is used by BindingFactory implementors, contributing new binding language engines (current languages are "javascript", "el", and "xpath"). It should be used whenever splitting a binding string like "Hello #{javascript: @UserName()}" to find the engine prefix(es) and expression to pass to the engine, instead of trying to implement your own code to find the #{ and : delimiters. The implementation is complicated by special handling for loadtime bindings that return runtime bindings, so that strings like "${javascript: '#{'+compositeData.var+'}' }" do not give invalid EL syntax errors.


Field Summary
static char CHAR_DELIM
           
static java.lang.String LANG_EL
           
static int LOADTIME_EXPRESSION
           
static int RUNTIME_EXPRESSION
           
static java.lang.String STR_DELIM
           
static java.lang.String VBL_END
           
static java.lang.String VBL_START
           
static java.lang.String VBLX_END
           
static java.lang.String VBLX_START
           
 
Constructor Summary
ValueBindingUtil()
           
 
Method Summary
static java.lang.String convertLoadtimeExpression(java.lang.String expression)
          Convert a load time expression to the equivalent runtime expression
static java.lang.String getExpressionString(java.lang.String prefix, java.lang.String expression, int type)
           
static java.lang.String[] getMultiPartExpressionParts(java.lang.String expression)
           
static java.lang.String getPrefix(java.lang.String expression)
          Return the prefix for a expression
static boolean isExpression(java.lang.String value, java.lang.String startDelim, java.lang.String endDelim)
          Return true if the string is a valid expression using the specified delimiters
static boolean isLoadtimeExpression(java.lang.String value)
          Return true if the string is a valid load time expression
static boolean isMultiPartExpression(java.lang.String expression)
          Return true if this is a multi-part VBL expression i.e.
static boolean isRuntimeExpression(java.lang.String value)
          Return true if the string is a valid run time expression
static boolean isSimpleExpression(java.lang.String expression)
          Return true if this is a valid expression
static boolean isSimpleLoadtimeExpression(java.lang.String expression)
          Return true if this is a VBL expression using the extended delimiters
static boolean isSimpleRuntimeExpression(java.lang.String expression)
          Return true if this is a standard VBL expression
static boolean isValueBindingExpression(java.lang.String expression)
          Return true if the specified string is a value binding expression.
static java.lang.String[] parseMultiPartExpression(java.lang.String expression)
          Parse a multipart value binding expression into it's individual parts
static java.lang.String parseSimpleExpression(java.lang.String expression)
          Return the expression for a expression
static java.lang.String[] splitFormula(java.lang.String prefix, java.lang.String formula)
          Split a value binding expression which is optionally prefixed with a value binding type
static java.lang.String stripDelimiters(java.lang.String expression)
          Strip the delimiters off a expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LANG_EL

public static final java.lang.String LANG_EL
See Also:
Constant Field Values

VBL_START

public static final java.lang.String VBL_START
See Also:
Constant Field Values

VBL_END

public static final java.lang.String VBL_END
See Also:
Constant Field Values

VBLX_START

public static final java.lang.String VBLX_START
See Also:
Constant Field Values

VBLX_END

public static final java.lang.String VBLX_END
See Also:
Constant Field Values

STR_DELIM

public static final java.lang.String STR_DELIM
See Also:
Constant Field Values

CHAR_DELIM

public static final char CHAR_DELIM
See Also:
Constant Field Values

RUNTIME_EXPRESSION

public static final int RUNTIME_EXPRESSION
See Also:
Constant Field Values

LOADTIME_EXPRESSION

public static final int LOADTIME_EXPRESSION
See Also:
Constant Field Values
Constructor Detail

ValueBindingUtil

public ValueBindingUtil()
Method Detail

getExpressionString

public static java.lang.String getExpressionString(java.lang.String prefix,
                                                   java.lang.String expression,
                                                   int type)
Parameters:
prefix -
expression -
type - specify the type of expression this is. valid values are: ValudBindingUtil.RUNTIME_EXPRESSION, ValudBindingUtil.LOADTIME_EXPRESSION
Returns:

isValueBindingExpression

public static boolean isValueBindingExpression(java.lang.String expression)
Return true if the specified string is a value binding expression.


isLoadtimeExpression

public static boolean isLoadtimeExpression(java.lang.String value)
Return true if the string is a valid load time expression


isRuntimeExpression

public static boolean isRuntimeExpression(java.lang.String value)
Return true if the string is a valid run time expression


isExpression

public static boolean isExpression(java.lang.String value,
                                   java.lang.String startDelim,
                                   java.lang.String endDelim)
Return true if the string is a valid expression using the specified delimiters


convertLoadtimeExpression

public static java.lang.String convertLoadtimeExpression(java.lang.String expression)
Convert a load time expression to the equivalent runtime expression


getPrefix

public static java.lang.String getPrefix(java.lang.String expression)
Return the prefix for a expression


parseSimpleExpression

public static java.lang.String parseSimpleExpression(java.lang.String expression)
Return the expression for a expression


stripDelimiters

public static java.lang.String stripDelimiters(java.lang.String expression)
Strip the delimiters off a expression


isSimpleExpression

public static boolean isSimpleExpression(java.lang.String expression)
Return true if this is a valid expression


isSimpleRuntimeExpression

public static boolean isSimpleRuntimeExpression(java.lang.String expression)
Return true if this is a standard VBL expression


isSimpleLoadtimeExpression

public static boolean isSimpleLoadtimeExpression(java.lang.String expression)
Return true if this is a VBL expression using the extended delimiters


isMultiPartExpression

public static boolean isMultiPartExpression(java.lang.String expression)
Return true if this is a multi-part VBL expression i.e. if this expression has multiple tokens and if the expression tokens are not EL


getMultiPartExpressionParts

public static java.lang.String[] getMultiPartExpressionParts(java.lang.String expression)

parseMultiPartExpression

public static java.lang.String[] parseMultiPartExpression(java.lang.String expression)
Parse a multipart value binding expression into it's individual parts


splitFormula

public static java.lang.String[] splitFormula(java.lang.String prefix,
                                              java.lang.String formula)
Split a value binding expression which is optionally prefixed with a value binding type