Package org.zkoss.zk.xel.impl
Class Utils
java.lang.Object
org.zkoss.zk.xel.impl.Utils
Utilities to handle the metainfo.
- Since:
- 3.0.6
- Author:
- tomyeh
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intUsed withparseComposite(java.lang.String, java.lang.Class, int)to indicate the expression is a vector, i.e., a list separated with comma.static final intUsed withparseComposite(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 final intUsed withparseComposite(java.lang.String, java.lang.Class, int)to indicate the expression is a scalar value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectevaluateComposite(Evaluator eval, Component comp, Object expr) Evaluates the composite expression parsed byparseComposite(java.lang.String, java.lang.Class, int)against a component.static ObjectevaluateComposite(Evaluator eval, Page page, Object expr) Evaluates the composite expression parsed byparseComposite(java.lang.String, java.lang.Class, int)against a page.static ObjectparseComposite(String expr, Class expcls, int type) Parses an expression which could a scalar, vector or map, depending on the specified type.static ExValue[]Parses a list of expressions that is separated by comma.
-
Field Details
-
SCALAR
public static final int SCALARUsed withparseComposite(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:
-
LIST
public static final int LISTUsed withparseComposite(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:
-
MAP
public static final int MAPUsed withparseComposite(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:
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
parseList
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
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" ifevaluateComposite(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 toparseList(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 ofSCALAR,LISTandMAP.- Returns:
- ExValue if
SCALAR, ExValue[] ifLIST, Map(String, ExValue) ifMAP, or null if expr is null. To evaluate it, invokeevaluateComposite(org.zkoss.zk.xel.Evaluator, org.zkoss.zk.ui.Component, java.lang.Object)by passing the returned value as its expr argument.
-
evaluateComposite
Evaluates the composite expression parsed byparseComposite(java.lang.String, java.lang.Class, int)against a component. -
evaluateComposite
Evaluates the composite expression parsed byparseComposite(java.lang.String, java.lang.Class, int)against a page.
-