Class ModifierSpec
java.lang.Object
com.bazaarvoice.jolt.modifier.spec.ModifierSpec
- All Implemented Interfaces:
BaseSpec
- Direct Known Subclasses:
ModifierCompositeSpec, ModifierLeafSpec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final OpModeprotected final MatchablePathElementprotected static final TraversalBuilder -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedModifierSpec(String rawJsonKey, OpMode opMode) Builds LHS pathElement and validates to specification -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(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 voidapplyElement(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 voidsetData(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
-
-
Method Details
-
getPathElement
Description copied from interface:BaseSpecGimme the LHS path element- Specified by:
getPathElementin 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:BaseSpecThis 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
-