Package com.bazaarvoice.jolt.cardinality
Class CardinalitySpec
java.lang.Object
com.bazaarvoice.jolt.cardinality.CardinalitySpec
- All Implemented Interfaces:
BaseSpec
- Direct Known Subclasses:
CardinalityCompositeSpec
,CardinalityLeafSpec
A Spec Object represents a single line from the JSON Cardinality Spec.
At a minimum a single Spec has :
Raw LHS spec value
Some kind of PathElement (based off that raw LHS value)
Additionally there are 2 distinct subclasses of the base Spec
CardinalityLeafSpec : where the RHS is either "ONE" or "MANY"
CardinalityCompositeSpec : where the RHS is a map of children Specs
The tree structure of formed by the CompositeSpecs is what is used during the transform
to do the parallel tree walk with the input data tree.
During the parallel tree walk, a Path is maintained, and used when
a tree walk encounters a leaf spec.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
protected final MatchablePathElement
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
apply
(String inputKey, Optional<Object> inputOptional, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) This is the main recursive method of the Shiftr/Templatr/Cardinality parallel "spec" and "input" tree walk.abstract boolean
applyCardinality
(String inputKey, Object input, WalkedPath walkedPath, Object parentContainer) This is the main recursive method of the CardinalityTransform parallel "spec" and "input" tree walk.Gimme the LHS path elementstatic List
<PathElement>
-
Field Details
-
STAR
- See Also:
-
AT
- See Also:
-
pathElement
-
-
Constructor Details
-
CardinalitySpec
-
-
Method Details
-
parse
-
applyCardinality
public abstract boolean applyCardinality(String inputKey, Object input, WalkedPath walkedPath, Object parentContainer) This is the main recursive method of the CardinalityTransform parallel "spec" and "input" tree walk. It should return true if this Spec object was able to successfully apply itself given the inputKey and input object. In the context of the CardinalityTransform parallel treewalk, if this method returns a non-null Object, the assumption is that no other sibling Cardinality specs need to look at this particular input key.- Returns:
- true if this this spec "handles" the inputkey such that no sibling specs need to see it
-
apply
public boolean apply(String inputKey, Optional<Object> inputOptional, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) Description copied from interface:BaseSpec
This is the main recursive method of the Shiftr/Templatr/Cardinality parallel "spec" and "input" tree walk. It should return true if this Spec object was able to successfully apply itself given the inputKey and input object. In the context of the Shiftr parallel treewalk, if this method returns true, the assumption is that no other sibling Shiftr specs need to look at this particular input key. -
getPathElement
Description copied from interface:BaseSpec
Gimme the LHS path element- Specified by:
getPathElement
in interfaceBaseSpec
- Returns:
- LHS path element for comparison
-