1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.extend.repository.maven.pom;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 public class Dependencies {
19
20 protected List<Dependency> dependencies = new ArrayList<Dependency>();
21
22 public Dependencies() {
23 }
24
25 public List<Dependency> getDependencies() {
26 return dependencies;
27 }
28
29 public Dependency addDependency() {
30 Dependency dependency = new Dependency();
31 dependencies.add(dependency);
32 return dependency;
33 }
34
35 public Dependency findDependency(String groupId, String artifactId) {
36 for (Dependency dependency : dependencies) {
37 if (groupId.equals(dependency.getGroupId()) && artifactId.equals(dependency.getArtifactId())) {
38 return dependency;
39 }
40 }
41 return null;
42 }
43
44 public String toString(int indent) {
45 StringBuffer res = new StringBuffer();
46 ToStringHelper.openTag("dependencies", res, indent);
47 for (Dependency dep : dependencies) {
48 res.append(dep.toString(indent + 2));
49 }
50 ToStringHelper.closeTag("dependencies", res, indent);
51 return res.toString();
52 }
53
54 public String toString() {
55 return toString(2);
56 }
57
58 }