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 lombok.val;
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) {
val path = new StringBuilder();
node.getData()
.map(PackageData::getName)
.ifPresent(name -> node.getParent().ifPresent(parent -> {
if (!parent.equals(base)) {
path.append(getPath(parent, base, delimiter))
.append(delimiter);
}
path.append(name);
}));
return path.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy