Package com.consol.citrus.variable
Class VariableExpressionIterator
- java.lang.Object
-
- com.consol.citrus.variable.VariableExpressionIterator
-
- All Implemented Interfaces:
Iterator<VariableExpressionIterator.VariableSegment>
public class VariableExpressionIterator extends Object implements Iterator<VariableExpressionIterator.VariableSegment>
ThisIteratoruses 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 Modifier and Type Class Description static classVariableExpressionIterator.VariableSegment
-
Constructor Summary
Constructors Constructor Description VariableExpressionIterator(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> segmentValueExtractors)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ObjectgetLastExpressionValue(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> extractors)booleanhasNext()Returns true if the iterator has a nextVariableExpressionIterator.VariableSegmentnext()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, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Constructor Detail
-
VariableExpressionIterator
public VariableExpressionIterator(String variableExpression, TestContext testContext, List<SegmentVariableExtractor> segmentValueExtractors)
-
-
Method Detail
-
hasNext
public boolean hasNext()
Returns true if the iterator has a next- Specified by:
hasNextin interfaceIterator<VariableExpressionIterator.VariableSegment>- Returns:
-
next
public VariableExpressionIterator.VariableSegment 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)
-
-