Created
November 27, 2012 20:43
-
-
Save gastaldi/4156883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright 2012 Red Hat, Inc. and/or its affiliates. | |
| * | |
| * Licensed under the Eclipse Public License version 1.0, available at | |
| * http://www.eclipse.org/legal/epl-v10.html | |
| */ | |
| package org.jboss.forge.maven.container; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import org.jboss.forge.addon.dependency.Dependency; | |
| import org.jboss.forge.addon.dependency.DependencyNode; | |
| public class MavenDependencyNode implements DependencyNode | |
| { | |
| private Dependency dependency; | |
| private List<DependencyNode> children = new ArrayList<DependencyNode>(); | |
| public MavenDependencyNode(Dependency dependency) | |
| { | |
| super(); | |
| this.dependency = dependency; | |
| } | |
| @Override | |
| public Dependency getDependency() | |
| { | |
| return dependency; | |
| } | |
| @Override | |
| public List<DependencyNode> getChildren() | |
| { | |
| return children; | |
| } | |
| @Override | |
| public String toString() | |
| { | |
| StringBuilder builder = new StringBuilder(); | |
| prettyPrint(builder, 0); | |
| return builder.toString(); | |
| } | |
| protected void prettyPrint(StringBuilder builder, int depth) | |
| { | |
| for (int i = 0; i < depth; i++) | |
| { | |
| builder.append("\t"); | |
| } | |
| builder.append("|-").append(dependency).append("\n"); | |
| for (DependencyNode child : getChildren()) | |
| { | |
| ((MavenDependencyNode) child).prettyPrint(builder, depth + 1); | |
| } | |
| } | |
| } | |
| |-Dependency [Coordinate [groupId=org.hibernate, artifactId=hibernate-core, version=4.0.0.Final, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=commons-collections, artifactId=commons-collections, version=3.2.1, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=antlr, artifactId=antlr, version=2.7.7, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=org.jboss.spec.javax.transaction, artifactId=jboss-transaction-api_1.1_spec, version=1.0.0.Final, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=dom4j, artifactId=dom4j, version=1.6.1, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=xml-apis, artifactId=xml-apis, version=1.0.b2, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=org.hibernate.javax.persistence, artifactId=hibernate-jpa-2.0-api, version=1.0.1.Final, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=org.jboss.logging, artifactId=jboss-logging, version=3.1.0.CR2, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=com.fasterxml, artifactId=classmate, version=0.5.4, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=org.jboss, artifactId=jandex, version=1.0.3.Final, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=org.hibernate.common, artifactId=hibernate-commons-annotations, version=4.0.1.Final, classifier=, packaging=jar]] | |
| |-Dependency [Coordinate [groupId=javassist, artifactId=javassist, version=3.12.1.GA, classifier=, packaging=jar]] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment