public class Utils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int SCALAR
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 apublic static final int LIST
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}".public static final int MAP
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}".public static ExValue[] parseList(java.lang.String expr, java.lang.Class expcls, boolean ignoreEmpty)
ignoreEmpty
- whether to return null if expr is an empty expression.parseComposite(java.lang.String, java.lang.Class, int)
public static java.lang.Object parseComposite(java.lang.String expr, java.lang.Class expcls, int 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").
type
- one of SCALAR
, LIST
and MAP
.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.public static java.lang.Object evaluateComposite(Evaluator eval, Component comp, java.lang.Object expr)
parseComposite(java.lang.String, java.lang.Class, int)
against a component.public static java.lang.Object evaluateComposite(Evaluator eval, Page page, java.lang.Object expr)
parseComposite(java.lang.String, java.lang.Class, int)
against a page.Copyright © 2005-2023 Potix Corporation. All Rights Reserved.