Class ModifierSpec

    • 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 debugging
      MatchablePathElement getPathElement()
      Gimme the LHS path element
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • opMode

        protected final OpMode opMode
      • 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

      • 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.
        Specified by:
        apply in interface BaseSpec
        Returns:
        true if this this spec "handles" the inputkey such that no sibling specs need to see it
      • 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 object
        matchedElement - the current spec (leaf) element that was matched with input
        value - to write
        opMode - to determine if write is applicable