Class ModifierSpec
java.lang.Object
com.bazaarvoice.jolt.modifier.spec.ModifierSpec
- All Implemented Interfaces:
BaseSpec
- Direct Known Subclasses:
ModifierCompositeSpec
,ModifierLeafSpec
Base Templatr spec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final boolean
protected final OpMode
protected final MatchablePathElement
protected static final TraversalBuilder
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ModifierSpec
(String rawJsonKey, OpMode opMode) Builds LHS pathElement and validates to specification -
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.protected abstract void
applyElement
(String key, Optional<Object> inputOptional, MatchedElement thisLevel, WalkedPath walkedPath, Map<String, Object> context) Templatr specific override that is used in BaseSpec#apply(...) The name is changed for easy identification during debuggingGimme the LHS path elementprotected static void
setData
(Object parent, MatchedElement matchedElement, Object value, OpMode opMode) Static utility method for facilitating writes on input object
-
Field Details
-
TRAVERSAL_BUILDER
-
opMode
-
pathElement
-
checkValue
protected final boolean checkValue
-
-
Constructor Details
-
ModifierSpec
Builds LHS pathElement and validates to specification
-
-
Method Details
-
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(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. -
applyElement
protected abstract void applyElement(String key, Optional<Object> inputOptional, MatchedElement thisLevel, WalkedPath walkedPath, Map<String, 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(Object parent, MatchedElement matchedElement, 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
-