Package org.citrusframework.variable
Class VariableExpressionIterator
java.lang.Object
org.citrusframework.variable.VariableExpressionIterator
- All Implemented Interfaces:
Iterator<VariableExpressionIterator.VariableSegment>
public class VariableExpressionIterator
extends Object
implements Iterator<VariableExpressionIterator.VariableSegment>
This
Iterator uses a regular expression pattern to match individual
segments of a variableExpression. Each segment of a variable expression
represents a bean, either stored as variable in the TestContext (first
segment) or a property of the previous bean (all other segments). The
iterator provides VariableSegments which provide the name and an optional
index as well as the variable/property value corresponding to the segment.
Example: var1.persons[2].firstnames[0]
The iterator will provide the following VariableSegments for this expression
- the variable with name var1 from the TestContext
- the third element of the persons property of the variable retrieved in the previous step
- the first element of the firstnames property of the property retrieved in the previous step
- Author:
- Thorsten Schlathoelter
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionVariableExpressionIterator(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> segmentValueExtractors) -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectgetLastExpressionValue(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> extractors) booleanhasNext()Returns true if the iterator has a nextnext()Returns the next value and looks ahead for yet another next value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
VariableExpressionIterator
public VariableExpressionIterator(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> segmentValueExtractors)
-
-
Method Details
-
hasNext
public boolean hasNext()Returns true if the iterator has a next- Specified by:
hasNextin interfaceIterator<VariableExpressionIterator.VariableSegment>- Returns:
-
next
Returns the next value and looks ahead for yet another next value.- Specified by:
nextin interfaceIterator<VariableExpressionIterator.VariableSegment>- Returns:
-
getLastExpressionValue
public static Object getLastExpressionValue(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> extractors)
-