Class SerializingDependencyNodeVisitor

java.lang.Object
org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor
All Implemented Interfaces:
DependencyNodeVisitor

public class SerializingDependencyNodeVisitor extends Object implements DependencyNodeVisitor
A dependency node visitor that serializes visited nodes to a writer.
  • Field Details

  • Constructor Details

    • SerializingDependencyNodeVisitor

      public SerializingDependencyNodeVisitor(Writer writer)
      Creates a dependency node visitor that serializes visited nodes to the specified writer using whitespace tokens.
      Parameters:
      writer - the writer to serialize to
    • SerializingDependencyNodeVisitor

      public SerializingDependencyNodeVisitor(Writer writer, SerializingDependencyNodeVisitor.GraphTokens tokens)
      Creates a dependency node visitor that serializes visited nodes to the specified writer using the specified tokens.
      Parameters:
      writer - the writer to serialize to
      tokens - the tokens to use when serializing the dependency graph
  • Method Details

    • visit

      public boolean visit(DependencyNode node)
      Starts the visit to the specified dependency node.
      Specified by:
      visit in interface DependencyNodeVisitor
      Parameters:
      node - the dependency node to visit
      Returns:
      true to visit the specified dependency node's children, false to skip the specified dependency node's children and proceed to its next sibling
    • endVisit

      public boolean endVisit(DependencyNode node)
      Ends the visit to to the specified dependency node.
      Specified by:
      endVisit in interface DependencyNodeVisitor
      Parameters:
      node - the dependency node to visit
      Returns:
      true to visit the specified dependency node's next sibling, false to skip the specified dependency node's next siblings and proceed to its parent
    • indent

      private void indent(DependencyNode node)
      Writes the necessary tokens to indent the specified dependency node to this visitor's writer.
      Parameters:
      node - the dependency node to indent
    • isLast

      private boolean isLast(DependencyNode node)
      Gets whether the specified dependency node is the last of its siblings.
      Parameters:
      node - the dependency node to check
      Returns:
      true if the specified dependency node is the last of its last siblings
    • isLast

      private boolean isLast(DependencyNode node, int ancestorDepth)
      Gets whether the specified dependency node ancestor is the last of its siblings.
      Parameters:
      node - the dependency node whose ancestor to check
      ancestorDepth - the depth of the ancestor of the specified dependency node to check
      Returns:
      true if the specified dependency node ancestor is the last of its siblings