@ Override public boolean apply ( String inputKey , Optional < Object > inputOptional , WalkedPath walkedPath , Map < String , Object > output , Map < String , Object > context ) { MatchedElement thisLevel = pathElement . match ( inputKey , walkedPath ) ; if ( thisLevel == null ) { return false ; } // If we are a TransposePathElement, try to swap the "input" with what we lookup from the Transpose if ( pathElement instanceof TransposePathElement ) { TransposePathElement tpe = ( TransposePathElement ) this . pathElement ; // Note the data found may not be a String, thus we have to call the special objectEvaluate // Optional, because the input data could have been a valid null. Optional < Object > optional = tpe . objectEvaluate ( walkedPath ) ; if ( ! optional . isPresent ( ) ) { return false ; } inputOptional = optional ; } // add ourselves to the path, so that our children can reference us walkedPath . add ( inputOptional . get ( ) , thisLevel ) ; // Handle any special / key based children first, but don't have them block anything for ( ShiftrSpec subSpec : specialChildren ) { subSpec . apply ( inputKey , inputOptional , walkedPath , output , context ) ; } // Handle the rest of the children executionStrategy . process ( this , inputOptional , walkedPath , output , context ) ; // We are done, so remove ourselves from the walkedPath walkedPath . removeLast ( ) ; // we matched so increment the matchCount of our parent walkedPath . lastElement ( ) . getMatchedElement ( ) . incrementHashCount ( ) ; return true ; }
If this Spec matches the inputKey then perform one step in the Shiftr parallel treewalk .