public interface PlanInterpreter
Most common usages simple need to supply applyYamlPrimitive(PlanInterpretationNode)
which can invoke
PlanInterpretationNode.setNewValue(Object)
to change.
The PlanInterpreter.PlanInterpreterAdapter
makes this easy by supplying all methods but that.
For more sophisticated usages, to act on entire maps or lists, there are a number of other hook functions, described below.
Modifier and Type | Interface and Description |
---|---|
static class |
PlanInterpreter.PlanInterpreterAdapter |
Modifier and Type | Method and Description |
---|---|
void |
applyListAfter(PlanInterpretationNode node,
java.util.List<java.lang.Object> listIn,
java.util.List<java.lang.Object> listOut)
as
applyMapAfter(PlanInterpretationNode, Map, Map) but for lists |
boolean |
applyListBefore(PlanInterpretationNode node,
java.util.List<java.lang.Object> listIn)
as
applyMapBefore(PlanInterpretationNode, Map) but for lists |
boolean |
applyListEntry(PlanInterpretationNode node,
java.util.List<java.lang.Object> listIn,
java.util.List<java.lang.Object> listOut,
PlanInterpretationNode value)
as {@link #applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode) but for lists
|
void |
applyMapAfter(PlanInterpretationNode node,
java.util.Map<java.lang.Object,java.lang.Object> mapIn,
java.util.Map<java.lang.Object,java.lang.Object> mapOut)
invoked at a Map node in a YAML tree, after all entries have been passed to all interpreters'
applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode) . |
boolean |
applyMapBefore(PlanInterpretationNode node,
java.util.Map<java.lang.Object,java.lang.Object> mapIn)
invoked at a Map node in a YAML tree, before any conversion to mapOut.
|
boolean |
applyMapEntry(PlanInterpretationNode node,
java.util.Map<java.lang.Object,java.lang.Object> mapIn,
java.util.Map<java.lang.Object,java.lang.Object> mapOut,
PlanInterpretationNode key,
PlanInterpretationNode value)
invoked at a Map node in a YAML tree, after
applyMapBefore(PlanInterpretationNode, Map) ,
and after recursing into the value and then key arguments supplied here,
but before inserting it into the mapOut for this node. |
void |
applyYamlPrimitive(PlanInterpretationNode node)
provides an opportunity for an interpreter to change the value at a node,
using
PlanInterpretationNode#get() and PlanInterpretationNode.setNewValue(Object) |
boolean |
isInterestedIn(PlanInterpretationNode node)
guard to prevent any apply calls when an Interpreter is not interested in a node
|
boolean isInterestedIn(PlanInterpretationNode node)
void applyYamlPrimitive(PlanInterpretationNode node)
PlanInterpretationNode#get()
and PlanInterpretationNode.setNewValue(Object)
boolean applyMapBefore(PlanInterpretationNode node, java.util.Map<java.lang.Object,java.lang.Object> mapIn)
PlanInterpretationNode#get()
, but it is mutable,
and any mutations are passed to subsequent interpreters and used for recursion.
the return value indicates whether to recurse into the item.
if any interpreters return false, the node is not recursed.
(callers may use PlanInterpretationNode.setNewValue(Object)
to set a custom return value.)
boolean applyMapEntry(PlanInterpretationNode node, java.util.Map<java.lang.Object,java.lang.Object> mapIn, java.util.Map<java.lang.Object,java.lang.Object> mapOut, PlanInterpretationNode key, PlanInterpretationNode value)
applyMapBefore(PlanInterpretationNode, Map)
,
and after recursing into the value and then key arguments supplied here,
but before inserting it into the mapOut for this node.
the return value indicates whether to add this key-value to the mapOut. if any interpreters return false, the entry is not added. (callers may modify mapOut to add/change values, or may modify key/value directly.)
void applyMapAfter(PlanInterpretationNode node, java.util.Map<java.lang.Object,java.lang.Object> mapIn, java.util.Map<java.lang.Object,java.lang.Object> mapOut)
applyMapEntry(PlanInterpretationNode, Map, Map, PlanInterpretationNode, PlanInterpretationNode)
.
mapOut can be modified yet further.boolean applyListBefore(PlanInterpretationNode node, java.util.List<java.lang.Object> listIn)
applyMapBefore(PlanInterpretationNode, Map)
but for listsboolean applyListEntry(PlanInterpretationNode node, java.util.List<java.lang.Object> listIn, java.util.List<java.lang.Object> listOut, PlanInterpretationNode value)
void applyListAfter(PlanInterpretationNode node, java.util.List<java.lang.Object> listIn, java.util.List<java.lang.Object> listOut)
applyMapAfter(PlanInterpretationNode, Map, Map)
but for lists