Package com.bazaarvoice.jolt.defaultr
Class Key
- java.lang.Object
-
- com.bazaarvoice.jolt.defaultr.Key
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKey.KeyPrecedenceComparator
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<Key>childrenprivate booleanisArrayOutputprivate static Key.KeyPrecedenceComparatorkeyComparatorprotected java.util.List<java.lang.String>keyStringsprotected java.lang.ObjectliteralValueprivate OPSopprivate static java.lang.StringOR_INPUT_REGEXprivate intorCountprivate intoutputArraySizeprotected java.lang.StringrawKey
-
Constructor Summary
Constructors Constructor Description Key(java.lang.String rawJsonKey, java.lang.Object spec)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidapplyChild(java.lang.Object container)Apply this Key to the defaultee.voidapplyChildren(java.lang.Object defaultee)This is the main "recursive" method.java.lang.ObjectcreateOutputContainerObject()protected abstract intgetLiteralIntKey()OPSgetOp()intgetOrCount()intgetOutputArraySize()booleanisArrayOutput()static java.util.Set<Key>parseSpec(java.util.Map<java.lang.String,java.lang.Object> spec)Factory-ish method that recursively processes a Mapinto a Set objects. private static java.util.Set<Key>processSpec(boolean parentIsArray, java.util.Map<java.lang.String,java.lang.Object> spec)Recursively walk the spec input tree.
-
-
-
Field Detail
-
OR_INPUT_REGEX
private static final java.lang.String OR_INPUT_REGEX
- See Also:
- Constant Field Values
-
keyComparator
private static final Key.KeyPrecedenceComparator keyComparator
-
isArrayOutput
private boolean isArrayOutput
-
op
private OPS op
-
orCount
private int orCount
-
outputArraySize
private int outputArraySize
-
children
protected java.util.Set<Key> children
-
literalValue
protected java.lang.Object literalValue
-
rawKey
protected java.lang.String rawKey
-
keyStrings
protected java.util.List<java.lang.String> keyStrings
-
-
Method Detail
-
parseSpec
public static java.util.Set<Key> parseSpec(java.util.Map<java.lang.String,java.lang.Object> spec)
Factory-ish method that recursively processes a Mapinto a Set objects. - Parameters:
spec- Simple Jackson default Mapinput - Returns:
- Set of Keys from this level in the spec
-
processSpec
private static java.util.Set<Key> processSpec(boolean parentIsArray, java.util.Map<java.lang.String,java.lang.Object> spec)
Recursively walk the spec input tree. Handle arrays by telling DefaultrKeys if they need to be ArrayKeys, and to find the max default array length.
-
applyChildren
public void applyChildren(java.lang.Object defaultee)
This is the main "recursive" method. The defaultee should never be null, because the defaultee wasn't null, it was null and we created it, OR there was a mismatch between the Defaultr Spec and the input, and we didn't recurse.
-
getLiteralIntKey
protected abstract int getLiteralIntKey()
-
applyChild
protected abstract void applyChild(java.lang.Object container)
Apply this Key to the defaultee. If this Key is a WildCard key, this may apply to many entries in the container.
-
getOrCount
public int getOrCount()
-
isArrayOutput
public boolean isArrayOutput()
-
getOp
public OPS getOp()
-
getOutputArraySize
public int getOutputArraySize()
-
createOutputContainerObject
public java.lang.Object createOutputContainerObject()
-
-