Class AutoExpandArrayTraversalStep<DataType>
- java.lang.Object
-
- com.bazaarvoice.jolt.traversr.traversal.BaseTraversalStep<java.util.List<java.lang.Object>,DataType>
-
- com.bazaarvoice.jolt.traversr.traversal.ArrayTraversalStep<DataType>
-
- com.bazaarvoice.jolt.traversr.traversal.AutoExpandArrayTraversalStep<DataType>
-
- All Implemented Interfaces:
TraversalStep<java.util.List<java.lang.Object>,DataType>
public class AutoExpandArrayTraversalStep<DataType> extends ArrayTraversalStep<DataType>
Subclass of ArrayTraversalStep that does not care about array index numbers. Instead it will just do an array add on any set. Consequently, get and remove are rather meaningless. This exists, because we need a way in the human readable path, so say that we always want a list value. Example : "tuna.marlin.[]" We want the value of marlin to always be a list, and anytime we set data to marlin, it should just be added to the list.
-
-
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 AutoExpandArrayTraversalStep(Traversr traversr, TraversalStep child)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.ArrayTraversalStep
getStepType, newContainer
-
Methods inherited from class com.bazaarvoice.jolt.traversr.traversal.BaseTraversalStep
getChild, traverse
-
-
-
-
Constructor Detail
-
AutoExpandArrayTraversalStep
public AutoExpandArrayTraversalStep(Traversr traversr, TraversalStep child)
-
-
Method Detail
-
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.- Specified by:
get
in interfaceTraversalStep<java.util.List<java.lang.Object>,DataType>
- Overrides:
get
in classArrayTraversalStep<DataType>
- 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.- Specified by:
remove
in interfaceTraversalStep<java.util.List<java.lang.Object>,DataType>
- Overrides:
remove
in classArrayTraversalStep<DataType>
- 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.- Specified by:
overwriteSet
in interfaceTraversalStep<java.util.List<java.lang.Object>,DataType>
- Overrides:
overwriteSet
in classArrayTraversalStep<DataType>
- Returns:
- returns the data object if successful or null if it could not
-
-