Class ArrayTraversalStep<DataType>
- java.lang.Object
-
- com.bazaarvoice.jolt.traversr.traversal.BaseTraversalStep<java.util.List<java.lang.Object>,DataType>
-
- com.bazaarvoice.jolt.traversr.traversal.ArrayTraversalStep<DataType>
-
- All Implemented Interfaces:
TraversalStep<java.util.List<java.lang.Object>,DataType>
- Direct Known Subclasses:
AutoExpandArrayTraversalStep
public class ArrayTraversalStep<DataType> extends BaseTraversalStep<java.util.List<java.lang.Object>,DataType>
TraversalStep that expects to handle List objects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.bazaarvoice.jolt.traversr.traversal.TraversalStep
TraversalStep.Operation
-
-
Field Summary
-
Fields inherited from class com.bazaarvoice.jolt.traversr.traversal.BaseTraversalStep
child, traversr
-
-
Constructor Summary
Constructors Constructor Description ArrayTraversalStep(Traversr traversr, TraversalStep child)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
ensureArraySize(java.util.List<java.lang.Object> list, java.lang.Integer upperIndex)
Optional<DataType>
get(java.util.List<java.lang.Object> list, java.lang.String key)
Return the data for the key from the provided tree object.java.lang.Class
getStepType()
Return the Class of the Generic T, so that it can be used in an "instanceof" style check.java.util.List<java.lang.Object>
newContainer()
Create a new mutable Map or List, suitable for this PathElement to traverse.Optional<DataType>
overwriteSet(java.util.List<java.lang.Object> list, java.lang.String key, DataType data)
Insert the data into the tree, overwriting any data that is there.Optional<DataType>
remove(java.util.List<java.lang.Object> list, java.lang.String key)
Remove and return the data for the key from the provided tree object.-
Methods inherited from class com.bazaarvoice.jolt.traversr.traversal.BaseTraversalStep
getChild, traverse
-
-
-
-
Constructor Detail
-
ArrayTraversalStep
public ArrayTraversalStep(Traversr traversr, TraversalStep child)
-
-
Method Detail
-
getStepType
public java.lang.Class getStepType()
Description copied from interface:TraversalStep
Return the Class of the Generic T, so that it can be used in an "instanceof" style check.- Returns:
- Class that matches Generic parameter T
-
newContainer
public java.util.List<java.lang.Object> newContainer()
Description copied from interface:TraversalStep
Create a new mutable Map or List, suitable for this PathElement to traverse.- Returns:
- new List or Map, depending on the type of the Traversal
-
get
public Optional<DataType> get(java.util.List<java.lang.Object> list, java.lang.String key)
Description copied from interface:TraversalStep
Return the data for the key from the provided tree object.- Returns:
- data object if available, or null.
-
remove
public Optional<DataType> remove(java.util.List<java.lang.Object> list, java.lang.String key)
Description copied from interface:TraversalStep
Remove and return the data for the key from the provided tree object.- Returns:
- data object if available, or null.
-
overwriteSet
public Optional<DataType> overwriteSet(java.util.List<java.lang.Object> list, java.lang.String key, DataType data)
Description copied from interface:TraversalStep
Insert the data into the tree, overwriting any data that is there.- Returns:
- returns the data object if successful or null if it could not
-
ensureArraySize
private static void ensureArraySize(java.util.List<java.lang.Object> list, java.lang.Integer upperIndex)
-
-