All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.maven.plugins.overview.render.MyVertexStringer Maven / Gradle / Ivy

Go to download

A Maven plugin, creating a diagram of all dependencies (The entire transitive closure). Works also as report.

The newest version!
package com.googlecode.maven.plugins.overview.render;

import com.googlecode.maven.plugins.overview.vo.ArtifactVertex;
import edu.uci.ics.jung.graph.ArchetypeVertex;
import edu.uci.ics.jung.graph.decorators.VertexStringer;
import org.apache.maven.artifact.Artifact;

/**
 * Vertex string value provider.
 */
public class MyVertexStringer implements VertexStringer {
  private boolean fullLabel;
  private boolean showVersion;

  /**
   * Ctor for vertex stringer.
   *
   * @param fullLabel if true labels are going to be full
   *                  IDs, if false labels are going to be
   * @param showVersion if artifact version should be shown on graph.
   */
  public MyVertexStringer(boolean fullLabel, boolean showVersion) {
    this.fullLabel = fullLabel;
    this.showVersion = showVersion;
  }

  /** {@inheritDoc} */
  public String getLabel(ArchetypeVertex vertex) {
    if (vertex instanceof ArtifactVertex) {
      Artifact artifact = ((ArtifactVertex) vertex).getArtifact();
      return fullLabel ?
              artifact.getId() :
              artifact.getArtifactId() +
                      (showVersion ?
                        ':' + artifact.getVersion() :
                        "");
    } else {
      return null;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy