Architecture Diagrams for /vsch/flexmark-java[edit]
Packages / Module flexmark-util / com.vladsch.flexmark.util.ast / NodeVisitor

class NodeVisitor

Configurable node visitor handler which does not know anything about node subclasses while allowing easy configuration of custom visitor for nodes of interest to visit. Usage: myVisitor = new NodeVisitor( new VisitHandler<>(Document.class, this::visit), new VisitHandler<>(HtmlEntity.class, this::visit), new VisitHandler<>(SoftLineBreak.class, this::visit), new VisitHandler<>(HardLineBreak.class, this::visit) ); Document doc; myVisitor.visit(doc); NOTE: This class replaces the old NodeVisitor derived from NodeAdaptedVisitor. If you were overriding #visit(Node) to provide your own handling of child visits, in the current implementation,it only starts the visiting process and is no longer called for processing every child node. Previously the implementation for visit(Node) looked like: Override public void visit(Node node) { processNode(node, true, this::visit); VisitHandler<?> handler = getHandler(node); if (handler != null) { handler.visit(node); } else { visitChildren(node); } } } you will need to override #processNode(Node node,boolean withChildren,BiConsumer consumer) , and to change the logic of processing child nodes if withChildren is true and passing child processing to processChildren() instead of visitChildren. Override public void processNode(Node node, boolean withChildren, BiConsumer<Node, Visitor<Node>> processor) { Visitor<?> handler = getAction(node); if (handler != null) { processor.accept(node, visitor); } else if (withChildren) { processChildren(node, processor); } } }
Class fields and methods
class NodeVisitor
Configurable node visitor handler which does not know anything about no...
constructor NodeVisitor(handlers)
constructor NodeVisitor(handlers)
constructor NodeVisitor(handlers)
constructor NodeVisitor()
method addHandler(handler)
method addHandlers(handlers)
method addHandlers(handlers)
method addHandlers(handlers)
method addTypedHandlers(handlers)
method visit(node)
method visit(node,handler)
O
method visitChildren(parent)
O
method visitNodeOnly(node)