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 class
Key.KeyPrecedenceComparator
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<Key>
children
private boolean
isArrayOutput
private static Key.KeyPrecedenceComparator
keyComparator
protected java.util.List<java.lang.String>
keyStrings
protected java.lang.Object
literalValue
private OPS
op
private static java.lang.String
OR_INPUT_REGEX
private int
orCount
private int
outputArraySize
protected java.lang.String
rawKey
-
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 void
applyChild(java.lang.Object container)
Apply this Key to the defaultee.void
applyChildren(java.lang.Object defaultee)
This is the main "recursive" method.java.lang.Object
createOutputContainerObject()
protected abstract int
getLiteralIntKey()
OPS
getOp()
int
getOrCount()
int
getOutputArraySize()
boolean
isArrayOutput()
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()
-
-