Package com.bazaarvoice.jolt.cardinality
Class CardinalityCompositeSpec
- java.lang.Object
-
- com.bazaarvoice.jolt.cardinality.CardinalitySpec
-
- com.bazaarvoice.jolt.cardinality.CardinalityCompositeSpec
-
- All Implemented Interfaces:
BaseSpec
public class CardinalityCompositeSpec extends CardinalitySpec
CardinalitySpec that has children, which it builds and then manages during Transforms.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<CardinalitySpec>
computedChildren
private static ComputedKeysComparator
computedKeysComparator
private java.util.Map<java.lang.String,CardinalitySpec>
literalChildren
private static java.util.HashMap<java.lang.Class,java.lang.Integer>
orderMap
private CardinalityLeafSpec
specialChild
-
Fields inherited from class com.bazaarvoice.jolt.cardinality.CardinalitySpec
pathElement
-
-
Constructor Summary
Constructors Constructor Description CardinalityCompositeSpec(java.lang.String rawKey, java.util.Map<java.lang.String,java.lang.Object> spec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
applyCardinality(java.lang.String inputKey, java.lang.Object input, WalkedPath walkedPath, java.lang.Object parentContainer)
If this Spec matches the inputkey, then perform one step in the parallel treewalk.private static void
applyKeyToLiteralAndComputed(CardinalityCompositeSpec spec, java.lang.String subKeyStr, java.lang.Object subInput, WalkedPath walkedPath, java.lang.Object input)
This method implements the Cardinality matching behavior when we have both literal and computed children.private static java.util.List<CardinalitySpec>
createChildren(java.util.Map<java.lang.String,java.lang.Object> rawSpec)
Recursively walk the spec input tree.private void
process(java.lang.Object input, WalkedPath walkedPath)
-
Methods inherited from class com.bazaarvoice.jolt.cardinality.CardinalitySpec
apply, getPathElement, parse
-
-
-
-
Field Detail
-
orderMap
private static final java.util.HashMap<java.lang.Class,java.lang.Integer> orderMap
-
computedKeysComparator
private static final ComputedKeysComparator computedKeysComparator
-
specialChild
private CardinalityLeafSpec specialChild
-
literalChildren
private final java.util.Map<java.lang.String,CardinalitySpec> literalChildren
-
computedChildren
private final java.util.List<CardinalitySpec> computedChildren
-
-
Method Detail
-
createChildren
private static java.util.List<CardinalitySpec> createChildren(java.util.Map<java.lang.String,java.lang.Object> rawSpec)
Recursively walk the spec input tree.
-
applyCardinality
public boolean applyCardinality(java.lang.String inputKey, java.lang.Object input, WalkedPath walkedPath, java.lang.Object parentContainer)
If this Spec matches the inputkey, then perform one step in the parallel treewalk. Step one level down the input "tree" by carefully handling the List/Map nature the input to get the "one level down" data. Step one level down the Spec tree by carefully and efficiently applying our children to the "one level down" data.- Specified by:
applyCardinality
in classCardinalitySpec
- Returns:
- true if this this spec "handles" the inputkey such that no sibling specs need to see it
-
process
private void process(java.lang.Object input, WalkedPath walkedPath)
-
applyKeyToLiteralAndComputed
private static void applyKeyToLiteralAndComputed(CardinalityCompositeSpec spec, java.lang.String subKeyStr, java.lang.Object subInput, WalkedPath walkedPath, java.lang.Object input)
This method implements the Cardinality matching behavior when we have both literal and computed children. For each input key, we see if it matches a literal, and it not, try to match the key with every computed child.
-
-