1
2
3
4
5 package org.apache.maven.api.model;
6
7 import java.io.Serializable;
8 import java.util.ArrayList;
9 import java.util.Collection;
10 import java.util.Collections;
11 import java.util.HashMap;
12 import java.util.List;
13 import java.util.Map;
14 import java.util.Objects;
15 import java.util.Optional;
16 import java.util.Set;
17 import java.util.stream.Collectors;
18 import java.util.stream.Stream;
19 import org.apache.maven.api.annotations.Experimental;
20 import org.apache.maven.api.annotations.Generated;
21 import org.apache.maven.api.annotations.Immutable;
22 import org.apache.maven.api.annotations.Nonnull;
23 import org.apache.maven.api.annotations.NotThreadSafe;
24 import org.apache.maven.api.annotations.ThreadSafe;
25
26
27
28
29 @Experimental
30 @Generated @ThreadSafe @Immutable
31 public class Developer
32 extends Contributor
33 implements Serializable, InputLocationTracker
34 {
35
36
37
38 final String id;
39
40
41
42
43
44 protected Developer(Builder builder) {
45 super(builder);
46 this.id = builder.id != null ? builder.id : (builder.base != null ? builder.base.id : null);
47 }
48
49
50
51
52
53
54 public String getId() {
55 return this.id;
56 }
57
58
59
60
61
62
63 @Nonnull
64 public Builder with() {
65 return newBuilder(this);
66 }
67
68
69
70
71
72
73 @Nonnull
74 public Developer withName(String name) {
75 return newBuilder(this, true).name(name).build();
76 }
77
78
79
80
81
82
83 @Nonnull
84 public Developer withEmail(String email) {
85 return newBuilder(this, true).email(email).build();
86 }
87
88
89
90
91
92
93 @Nonnull
94 public Developer withUrl(String url) {
95 return newBuilder(this, true).url(url).build();
96 }
97
98
99
100
101
102
103 @Nonnull
104 public Developer withOrganization(String organization) {
105 return newBuilder(this, true).organization(organization).build();
106 }
107
108
109
110
111
112
113 @Nonnull
114 public Developer withOrganizationUrl(String organizationUrl) {
115 return newBuilder(this, true).organizationUrl(organizationUrl).build();
116 }
117
118
119
120
121
122
123 @Nonnull
124 public Developer withRoles(Collection<String> roles) {
125 return newBuilder(this, true).roles(roles).build();
126 }
127
128
129
130
131
132
133 @Nonnull
134 public Developer withTimezone(String timezone) {
135 return newBuilder(this, true).timezone(timezone).build();
136 }
137
138
139
140
141
142
143 @Nonnull
144 public Developer withProperties(Map<String, String> properties) {
145 return newBuilder(this, true).properties(properties).build();
146 }
147
148
149
150
151
152
153 @Nonnull
154 public Developer withId(String id) {
155 return newBuilder(this, true).id(id).build();
156 }
157
158
159
160
161
162
163
164
165 @Nonnull
166 public static Developer newInstance() {
167 return newInstance(true);
168 }
169
170
171
172
173
174
175
176
177 @Nonnull
178 public static Developer newInstance(boolean withDefaults) {
179 return newBuilder(withDefaults).build();
180 }
181
182
183
184
185
186
187
188
189 @Nonnull
190 public static Builder newBuilder() {
191 return newBuilder(true);
192 }
193
194
195
196
197
198
199
200 @Nonnull
201 public static Builder newBuilder(boolean withDefaults) {
202 return new Builder(withDefaults);
203 }
204
205
206
207
208
209
210
211
212 @Nonnull
213 public static Builder newBuilder(Developer from) {
214 return newBuilder(from, false);
215 }
216
217
218
219
220
221
222
223
224 @Nonnull
225 public static Builder newBuilder(Developer from, boolean forceCopy) {
226 return new Builder(from, forceCopy);
227 }
228
229
230
231
232
233
234 @NotThreadSafe
235 public static class Builder
236 extends Contributor.Builder
237 {
238 Developer base;
239 String id;
240
241 protected Builder(boolean withDefaults) {
242 super(withDefaults);
243 if (withDefaults) {
244 }
245 }
246
247 protected Builder(Developer base, boolean forceCopy) {
248 super(base, forceCopy);
249 if (forceCopy) {
250 this.id = base.id;
251 this.locations = base.locations;
252 this.importedFrom = base.importedFrom;
253 } else {
254 this.base = base;
255 }
256 }
257
258 @Nonnull
259 public Builder name(String name) {
260 this.name = name;
261 return this;
262 }
263
264 @Nonnull
265 public Builder email(String email) {
266 this.email = email;
267 return this;
268 }
269
270 @Nonnull
271 public Builder url(String url) {
272 this.url = url;
273 return this;
274 }
275
276 @Nonnull
277 public Builder organization(String organization) {
278 this.organization = organization;
279 return this;
280 }
281
282 @Nonnull
283 public Builder organizationUrl(String organizationUrl) {
284 this.organizationUrl = organizationUrl;
285 return this;
286 }
287
288 @Nonnull
289 public Builder roles(Collection<String> roles) {
290 this.roles = roles;
291 return this;
292 }
293
294 @Nonnull
295 public Builder timezone(String timezone) {
296 this.timezone = timezone;
297 return this;
298 }
299
300 @Nonnull
301 public Builder properties(Map<String, String> properties) {
302 this.properties = properties;
303 return this;
304 }
305
306 @Nonnull
307 public Builder id(String id) {
308 this.id = id;
309 return this;
310 }
311
312
313 @Nonnull
314 public Builder location(Object key, InputLocation location) {
315 if (location != null) {
316 if (!(this.locations instanceof HashMap)) {
317 this.locations = this.locations != null ? new HashMap<>(this.locations) : new HashMap<>();
318 }
319 this.locations.put(key, location);
320 }
321 return this;
322 }
323
324 @Nonnull
325 public Builder importedFrom(InputLocation importedFrom) {
326 this.importedFrom = importedFrom;
327 return this;
328 }
329
330 @Nonnull
331 public Developer build() {
332
333 if (base != null
334 && (name == null || name == base.name)
335 && (email == null || email == base.email)
336 && (url == null || url == base.url)
337 && (organization == null || organization == base.organization)
338 && (organizationUrl == null || organizationUrl == base.organizationUrl)
339 && (roles == null || roles == base.roles)
340 && (timezone == null || timezone == base.timezone)
341 && (properties == null || properties == base.properties)
342 && (id == null || id == base.id)
343 ) {
344 return base;
345 }
346 return new Developer(this);
347 }
348
349 }
350
351
352
353
354
355
356 public String toString() {
357 return "Developer {id=" + getId() + ", " + super.toString() + "}";
358 }
359
360
361 }