org.zkoss.zk.xel.impl
Class Utils

java.lang.Object
  extended by org.zkoss.zk.xel.impl.Utils

public class Utils
extends java.lang.Object

Utilities to handle the metainfo.

Since:
3.0.6
Author:
tomyeh

Field Summary
static int LIST
          Used with parseComposite(java.lang.String, java.lang.Class, int) to indicate the expression is a vector, i.e., a list separated with comma.
static int MAP
          Used with parseComposite(java.lang.String, java.lang.Class, int) to indicate the expression is a map, i.e., a map paired with equal and separated with comma.
static int SCALAR
          Used with parseComposite(java.lang.String, java.lang.Class, int) to indicate the expression is a scalar value.
 
Constructor Summary
Utils()
           
 
Method Summary
static java.lang.Object evaluateComposite(Evaluator eval, Component comp, java.lang.Object expr)
          Evaluates the composite expression parsed by parseComposite(java.lang.String, java.lang.Class, int) against a component.
static java.lang.Object evaluateComposite(Evaluator eval, Page page, java.lang.Object expr)
          Evaluates the composite expression parsed by parseComposite(java.lang.String, java.lang.Class, int) against a page.
static java.lang.Object parseComposite(java.lang.String expr, java.lang.Class expcls, int type)
          Parses an expression which could a scalar, vector or map, depending on the specified type.
static ExValue[] parseList(java.lang.String expr, java.lang.Class expcls, boolean ignoreEmpty)
          Parses a list of expressions that is separated by comma.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCALAR

public static final int SCALAR
Used with parseComposite(java.lang.String, java.lang.Class, int) to indicate the expression is a scalar value. In other words, it won't handle it specially. If a

See Also:
Constant Field Values

LIST

public static final int LIST
Used with parseComposite(java.lang.String, java.lang.Class, int) to indicate the expression is a vector, i.e., a list separated with comma. Example: "first, ${second}".

See Also:
Constant Field Values

MAP

public static final int MAP
Used with parseComposite(java.lang.String, java.lang.Class, int) to indicate the expression is a map, i.e., a map paired with equal and separated with comma. Example: "one=first, two=${second}".

See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

parseList

public static ExValue[] parseList(java.lang.String expr,
                                  java.lang.Class expcls,
                                  boolean ignoreEmpty)
Parses a list of expressions that is separated by comma. For example, parseList("${a}, b, ${c}", Object.class) will return a three-element array.

Parameters:
ignoreEmpty - whether to return null if expr is an empty expression.
Returns:
an array of the parsed expressions (at least with one element), or null if expr is null.
See Also:
parseComposite(java.lang.String, java.lang.Class, int)

parseComposite

public static java.lang.Object parseComposite(java.lang.String expr,
                                              java.lang.Class expcls,
                                              int type)
Parses an expression which could a scalar, vector or map, depending on the specified type.

If type is SCALAR, it is a simple expression and no special parsing happens. For example, "a, ${b}" will be evaluated to "a, boy" if b is "boy" if evaluateComposite(org.zkoss.zk.xel.Evaluator, org.zkoss.zk.ui.Component, java.lang.Object) is called.

If type is LIST, the expression is a list separated with comma. For example, "a, ${b}" will be evaluated to a list with two elements: "a" and "boy". It is similar to parseList(java.lang.String, java.lang.Class, boolean).

If type is MAP, the expression is a list of paired entries. For example, "a=apple, b=${b}" will be evaluated to a map with two entries, ("a", "apple") and ("b", "boy").

Parameters:
type - one of SCALAR, LIST and MAP.
Returns:
ExValue if SCALAR, ExValue[] if LIST, Map(String, ExValue) if MAP, or null if expr is null. To evaluate it, invoke evaluateComposite(org.zkoss.zk.xel.Evaluator, org.zkoss.zk.ui.Component, java.lang.Object) by passing the returned value as its expr argument.

evaluateComposite

public static java.lang.Object evaluateComposite(Evaluator eval,
                                                 Component comp,
                                                 java.lang.Object expr)
Evaluates the composite expression parsed by parseComposite(java.lang.String, java.lang.Class, int) against a component.


evaluateComposite

public static java.lang.Object evaluateComposite(Evaluator eval,
                                                 Page page,
                                                 java.lang.Object expr)
Evaluates the composite expression parsed by parseComposite(java.lang.String, java.lang.Class, int) against a page.



Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo