Class ModifierSpec
- java.lang.Object
-
- com.bazaarvoice.jolt.modifier.spec.ModifierSpec
-
- All Implemented Interfaces:
BaseSpec
- Direct Known Subclasses:
ModifierCompositeSpec
,ModifierLeafSpec
public abstract class ModifierSpec extends java.lang.Object implements BaseSpec
Base Templatr spec
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
checkValue
protected OpMode
opMode
protected MatchablePathElement
pathElement
protected static TraversalBuilder
TRAVERSAL_BUILDER
-
Constructor Summary
Constructors Modifier Constructor Description protected
ModifierSpec(java.lang.String rawJsonKey, OpMode opMode)
Builds LHS pathElement and validates to specification
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
apply(java.lang.String inputKey, Optional<java.lang.Object> inputOptional, WalkedPath walkedPath, java.util.Map<java.lang.String,java.lang.Object> output, java.util.Map<java.lang.String,java.lang.Object> context)
This is the main recursive method of the Shiftr/Templatr/Cardinality parallel "spec" and "input" tree walk.protected abstract void
applyElement(java.lang.String key, Optional<java.lang.Object> inputOptional, MatchedElement thisLevel, WalkedPath walkedPath, java.util.Map<java.lang.String,java.lang.Object> context)
Templatr specific override that is used in BaseSpec#apply(...) The name is changed for easy identification during debuggingMatchablePathElement
getPathElement()
Gimme the LHS path elementprotected static void
setData(java.lang.Object parent, MatchedElement matchedElement, java.lang.Object value, OpMode opMode)
Static utility method for facilitating writes on input object
-
-
-
Field Detail
-
TRAVERSAL_BUILDER
protected static final TraversalBuilder TRAVERSAL_BUILDER
-
opMode
protected final OpMode opMode
-
pathElement
protected final MatchablePathElement pathElement
-
checkValue
protected final boolean checkValue
-
-
Constructor Detail
-
ModifierSpec
protected ModifierSpec(java.lang.String rawJsonKey, OpMode opMode)
Builds LHS pathElement and validates to specification
-
-
Method Detail
-
getPathElement
public MatchablePathElement getPathElement()
Description copied from interface:BaseSpec
Gimme the LHS path element- Specified by:
getPathElement
in interfaceBaseSpec
- Returns:
- LHS path element for comparison
-
apply
public boolean apply(java.lang.String inputKey, Optional<java.lang.Object> inputOptional, WalkedPath walkedPath, java.util.Map<java.lang.String,java.lang.Object> output, java.util.Map<java.lang.String,java.lang.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.
-
applyElement
protected abstract void applyElement(java.lang.String key, Optional<java.lang.Object> inputOptional, MatchedElement thisLevel, WalkedPath walkedPath, java.util.Map<java.lang.String,java.lang.Object> context)
Templatr specific override that is used in BaseSpec#apply(...) The name is changed for easy identification during debugging
-
setData
protected static void setData(java.lang.Object parent, MatchedElement matchedElement, java.lang.Object value, OpMode opMode)
Static utility method for facilitating writes on input object- Parameters:
parent
- the source objectmatchedElement
- the current spec (leaf) element that was matched with inputvalue
- to writeopMode
- to determine if write is applicable
-
-