
net.kemitix.dependency.digraph.maven.plugin.DefaultNodePathGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of digraph-dependency-maven-plugin Show documentation
Show all versions of digraph-dependency-maven-plugin Show documentation
Generates a DOT Digraph of dependencies between packages within a project
package net.kemitix.dependency.digraph.maven.plugin;
import net.kemitix.node.Node;
/**
* Default implementation of the Node ID Generator.
*
* @author Paul Campbell
*/
class DefaultNodePathGenerator implements NodePathGenerator {
@Override
public String getPath(
final Node node,
final Node base,
final String delimiter) {
final Node parent = node.getParent();
// if node has no parent, then "" is the path
if (parent == null) {
return "";
}
// if node's parent is base, then node is the path
if (parent.equals(base)) {
return node.getData().getName();
}
// else append to parent path
final StringBuilder path = new StringBuilder();
return path
.append(getPath(parent, base, delimiter))
.append(delimiter)
.append(node.getData().getName())
.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy