Class SerializingDependencyNodeVisitor
- java.lang.Object
-
- org.apache.maven.shared.dependency.graph.traversal.SerializingDependencyNodeVisitor
-
- All Implemented Interfaces:
DependencyNodeVisitor
public class SerializingDependencyNodeVisitor extends java.lang.Object implements DependencyNodeVisitor
A dependency node visitor that serializes visited nodes to a writer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSerializingDependencyNodeVisitor.GraphTokensProvides tokens to use when serializing the dependency graph.
-
Field Summary
Fields Modifier and Type Field Description private intdepthThe depth of the currently visited dependency node.static SerializingDependencyNodeVisitor.GraphTokensEXTENDED_TOKENSThe extended ASCII tokens to use when outputing the dependency graph.static SerializingDependencyNodeVisitor.GraphTokensSTANDARD_TOKENSThe standard ASCII tokens to use when outputing the dependency graph.private SerializingDependencyNodeVisitor.GraphTokenstokensThe tokens to use when serializing the dependency graph.static SerializingDependencyNodeVisitor.GraphTokensWHITESPACE_TOKENSWhitespace tokens to use when outputing the dependency graph.private java.io.PrintWriterwriterThe writer to serialize to.
-
Constructor Summary
Constructors Constructor Description SerializingDependencyNodeVisitor(java.io.Writer writer)Creates a dependency node visitor that serializes visited nodes to the specified writer using whitespace tokens.SerializingDependencyNodeVisitor(java.io.Writer writer, SerializingDependencyNodeVisitor.GraphTokens tokens)Creates a dependency node visitor that serializes visited nodes to the specified writer using the specified tokens.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanendVisit(DependencyNode node)Ends the visit to to the specified dependency node.private voidindent(DependencyNode node)Writes the necessary tokens to indent the specified dependency node to this visitor's writer.private booleanisLast(DependencyNode node)Gets whether the specified dependency node is the last of its siblings.private booleanisLast(DependencyNode node, int ancestorDepth)Gets whether the specified dependency node ancestor is the last of its siblings.booleanvisit(DependencyNode node)Starts the visit to the specified dependency node.
-
-
-
Field Detail
-
WHITESPACE_TOKENS
public static final SerializingDependencyNodeVisitor.GraphTokens WHITESPACE_TOKENS
Whitespace tokens to use when outputing the dependency graph.
-
STANDARD_TOKENS
public static final SerializingDependencyNodeVisitor.GraphTokens STANDARD_TOKENS
The standard ASCII tokens to use when outputing the dependency graph.
-
EXTENDED_TOKENS
public static final SerializingDependencyNodeVisitor.GraphTokens EXTENDED_TOKENS
The extended ASCII tokens to use when outputing the dependency graph.
-
writer
private final java.io.PrintWriter writer
The writer to serialize to.
-
tokens
private final SerializingDependencyNodeVisitor.GraphTokens tokens
The tokens to use when serializing the dependency graph.
-
depth
private int depth
The depth of the currently visited dependency node.
-
-
Constructor Detail
-
SerializingDependencyNodeVisitor
public SerializingDependencyNodeVisitor(java.io.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(java.io.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 totokens- the tokens to use when serializing the dependency graph
-
-
Method Detail
-
visit
public boolean visit(DependencyNode node)
Starts the visit to the specified dependency node.- Specified by:
visitin interfaceDependencyNodeVisitor- Parameters:
node- the dependency node to visit- Returns:
trueto visit the specified dependency node's children,falseto 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:
endVisitin interfaceDependencyNodeVisitor- Parameters:
node- the dependency node to visit- Returns:
trueto visit the specified dependency node's next sibling,falseto 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:
trueif 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 checkancestorDepth- the depth of the ancestor of the specified dependency node to check- Returns:
trueif the specified dependency node ancestor is the last of its siblings
-
-