Package org.zkoss.zk.ui.util
Class ForEachImpl
java.lang.Object
org.zkoss.zk.ui.util.ForEachImpl
- All Implemented Interfaces:
ForEach
An implementation of
ForEach.
Note: the use of ForEachImpl is different from
ConditionImpl. While you could use the same instance of
ConditionImpl for all evaluation, each instance of
ForEachImpl can be used only once (drop it after next()
returns false).
- Author:
- tomyeh
-
Constructor Summary
ConstructorsConstructorDescriptionForEachImpl(EvaluatorRef evalr, Component comp, String expr, String begin, String end) Constructor.ForEachImpl(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end) Constructor.ForEachImpl(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Constructor.ForEachImpl(EvaluatorRef evalr, Page page, String expr, String begin, String end) Constructor.ForEachImpl(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end) Constructor.ForEachImpl(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ForEachgetInstance(EvaluatorRef evalr, Component comp, String expr, String begin, String end) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.static ForEachgetInstance(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end) Returns an instance that represents the iterator for the specified collection.static ForEachgetInstance(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Returns an instance that represents the iterator for the specified collection.static ForEachgetInstance(EvaluatorRef evalr, Page page, String expr, String begin, String end) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.static ForEachgetInstance(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.static ForEachgetInstance(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.booleannext()Advanced to the next element.
-
Constructor Details
-
ForEachImpl
public ForEachImpl(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Constructor. In most cases, usegetInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue, ExValue)instead of this constructor.- Throws:
IllegalArgumentException- if comp or evalr is null- Since:
- 8.0.0
-
ForEachImpl
public ForEachImpl(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Constructor. In most cases, usegetInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue, ExValue)instead of this constructor.- Throws:
IllegalArgumentException- if page or evalr is null- Since:
- 8.0.0
-
ForEachImpl
Constructor. In most cases, usegetInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)instead of this constructor.- Throws:
IllegalArgumentException- if comp or evalr is null- Since:
- 3.0.6
-
ForEachImpl
Constructor. In most cases, usegetInstance(EvaluatorRef, Component, ExValue[], ExValue, ExValue)instead of this constructor.- Throws:
IllegalArgumentException- if page or evalr is null- Since:
- 3.0.6
-
ForEachImpl
Constructor. In most cases, usegetInstance(EvaluatorRef, Component, String, String, String)instead of this constructor.- Throws:
IllegalArgumentException- if comp or evalr is null- Since:
- 3.0.0
- See Also:
-
ForEachImpl
Constructor. In most cases, usegetInstance(EvaluatorRef, Component, String, String, String)instead of this constructor.- Throws:
IllegalArgumentException- if page or evalr is null- Since:
- 3.0.0
- See Also:
-
-
Method Details
-
getInstance
public static ForEach getInstance(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end) Returns an instance that represents the iterator for the specified collection.- Parameters:
expr- an array of expressions. There are two formats.- length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
- length > 1, it will iterate thru expr[0]
- length == 0 or expr is null, null is returned
- Since:
- 3.0.6
-
getInstance
public static ForEach getInstance(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.- Parameters:
expr- an array of expressions. There are two formats.- length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
- length > 1, it will iterate thru expr[0]
- length == 0 or expr is null, null is returned
- Since:
- 3.0.6
-
getInstance
public static ForEach getInstance(EvaluatorRef evalr, Component comp, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Returns an instance that represents the iterator for the specified collection.- Parameters:
expr- an array of expressions. There are two formats.- length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
- length > 1, it will iterate thru expr[0]
- length == 0 or expr is null, null is returned
- Since:
- 8.0.0
-
getInstance
public static ForEach getInstance(EvaluatorRef evalr, Page page, ExValue[] expr, ExValue begin, ExValue end, ExValue step) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.- Parameters:
expr- an array of expressions. There are two formats.- length == 1: it iterates thru the content of expr[0]. For example, if expr[0] is an array, all items in this array will be iterated.
- length > 1, it will iterate thru expr[0]
- length == 0 or expr is null, null is returned
- Since:
- 8.0.0
-
getInstance
public static ForEach getInstance(EvaluatorRef evalr, Component comp, String expr, String begin, String end) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.- Parameters:
expr- an EL expression that shall return a collection of objects.- See Also:
-
getInstance
public static ForEach getInstance(EvaluatorRef evalr, Page page, String expr, String begin, String end) Returns an instance that represents the iterator for the specified collection, or null if expr is null or empty.- Parameters:
expr- an EL expression that shall return a collection of objects.- Since:
- 3.0.0
- See Also:
-
next
public boolean next()Description copied from interface:ForEachAdvanced to the next element.
-