1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.shared.jar.identification;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24
25
26
27
28
29 public class JarIdentification {
30
31
32
33 private String groupId;
34
35
36
37
38 private String artifactId;
39
40
41
42
43 private String version;
44
45
46
47
48 private String name;
49
50
51
52
53 private String vendor;
54
55
56
57
58 private final List<String> potentialGroupIds = new ArrayList<>();
59
60
61
62
63 private final List<String> potentialArtifactIds = new ArrayList<>();
64
65
66
67
68 private final List<String> potentialVersions = new ArrayList<>();
69
70
71
72
73 private final List<String> potentialNames = new ArrayList<>();
74
75
76
77
78 private final List<String> potentialVendors = new ArrayList<>();
79
80
81
82
83
84
85 public void addAndSetGroupId(String groupId) {
86 if (groupId != null) {
87 this.groupId = groupId;
88 }
89
90 addGroupId(groupId);
91 }
92
93
94
95
96
97
98 public void addGroupId(String groupId) {
99 addUnique(potentialGroupIds, groupId);
100 }
101
102
103
104
105
106
107 public void addAndSetArtifactId(String artifactId) {
108 if (artifactId != null) {
109 this.artifactId = artifactId;
110 }
111
112 addArtifactId(artifactId);
113 }
114
115
116
117
118
119
120 public void addArtifactId(String artifactId) {
121 addUnique(potentialArtifactIds, artifactId);
122 }
123
124
125
126
127
128
129 public void addAndSetVersion(String version) {
130 if (version != null) {
131 this.version = version;
132 }
133
134 addVersion(version);
135 }
136
137
138
139
140
141
142 public void addVersion(String version) {
143 addUnique(potentialVersions, version);
144 }
145
146
147
148
149
150
151 public void addAndSetVendor(String name) {
152 if (name != null) {
153 vendor = name;
154 }
155
156 addVendor(name);
157 }
158
159
160
161
162
163
164 public void addVendor(String name) {
165 addUnique(potentialVendors, name);
166 }
167
168
169
170
171
172
173 public void addAndSetName(String name) {
174 if (name != null) {
175 this.name = name;
176 }
177
178 addName(name);
179 }
180
181
182
183
184
185
186 public void addName(String name) {
187 addUnique(potentialNames, name);
188 }
189
190 private static void addUnique(List<String> list, String value) {
191 if (value != null) {
192 if (!list.contains(value)) {
193 list.add(value);
194 }
195 }
196 }
197
198 public String getArtifactId() {
199 return artifactId;
200 }
201
202 public void setArtifactId(String artifactId) {
203 this.artifactId = artifactId;
204 }
205
206 public String getGroupId() {
207 return groupId;
208 }
209
210 public void setGroupId(String groupId) {
211 this.groupId = groupId;
212 }
213
214 public String getName() {
215 return name;
216 }
217
218 public void setName(String name) {
219 this.name = name;
220 }
221
222 public String getVendor() {
223 return vendor;
224 }
225
226 public void setVendor(String vendor) {
227 this.vendor = vendor;
228 }
229
230 public String getVersion() {
231 return version;
232 }
233
234 public void setVersion(String version) {
235 this.version = version;
236 }
237
238 public List<String> getPotentialVersions() {
239 return potentialVersions;
240 }
241
242 public List<String> getPotentialNames() {
243 return potentialNames;
244 }
245
246 public List<String> getPotentialGroupIds() {
247 return potentialGroupIds;
248 }
249
250 public List<String> getPotentialArtifactIds() {
251 return potentialArtifactIds;
252 }
253
254 public List<String> getPotentialVendors() {
255 return potentialVendors;
256 }
257 }