1
2
3
4
5 package org.apache.maven.api.model;
6
7 import java.io.Serializable;
8 import java.nio.file.Path;
9 import java.util.ArrayList;
10 import java.util.Collection;
11 import java.util.Collections;
12 import java.util.HashMap;
13 import java.util.List;
14 import java.util.Map;
15 import java.util.Set;
16 import org.apache.maven.api.annotations.Experimental;
17 import org.apache.maven.api.annotations.Generated;
18 import org.apache.maven.api.annotations.Immutable;
19 import org.apache.maven.api.annotations.Nonnull;
20 import org.apache.maven.api.annotations.NotThreadSafe;
21 import org.apache.maven.api.annotations.ThreadSafe;
22
23
24
25
26
27 @Experimental
28 @Generated @ThreadSafe @Immutable
29 public class Model
30 extends ModelBase
31 implements Serializable, InputLocationTracker
32 {
33 final String namespaceUri;
34 final String modelEncoding;
35
36
37
38 final Path pomFile;
39
40
41
42 final String modelVersion;
43
44
45
46
47
48 final Parent parent;
49
50
51
52
53
54 final String groupId;
55
56
57
58
59
60
61 final String artifactId;
62
63
64
65 final String version;
66
67
68
69
70
71
72
73
74
75 final String packaging;
76
77
78
79 final String name;
80
81
82
83
84
85
86
87 final String description;
88
89
90
91
92
93 final String url;
94
95
96
97
98
99
100
101 final String childProjectUrlInheritAppendPath;
102
103
104
105
106
107
108 final boolean root;
109
110
111
112
113
114 final boolean preserveModelVersion;
115
116
117
118
119 final String inceptionYear;
120
121
122
123
124
125 final Organization organization;
126
127
128
129
130
131
132
133
134
135 final List<License> licenses;
136
137
138
139 final List<Developer> developers;
140
141
142
143 final List<Contributor> contributors;
144
145
146
147 final List<MailingList> mailingLists;
148
149
150
151 final Prerequisites prerequisites;
152
153
154
155 final Scm scm;
156
157
158
159 final IssueManagement issueManagement;
160
161
162
163 final CiManagement ciManagement;
164
165
166
167 final Build build;
168
169
170
171
172 final List<Profile> profiles;
173
174 final Map<Object, InputLocation> locations;
175
176
177
178
179
180 protected Model(Builder builder) {
181 super(builder);
182 this.namespaceUri = builder.namespaceUri != null ? builder.namespaceUri : (builder.base != null ? builder.base.namespaceUri : null);
183 this.modelEncoding = builder.modelEncoding != null ? builder.modelEncoding : (builder.base != null ? builder.base.modelEncoding : "UTF-8");
184 this.pomFile = builder.pomFile != null ? builder.pomFile : (builder.base != null ? builder.base.pomFile : null);
185 this.modelVersion = builder.modelVersion != null ? builder.modelVersion : (builder.base != null ? builder.base.modelVersion : null);
186 this.parent = builder.parent != null ? builder.parent : (builder.base != null ? builder.base.parent : null);
187 this.groupId = builder.groupId != null ? builder.groupId : (builder.base != null ? builder.base.groupId : null);
188 this.artifactId = builder.artifactId != null ? builder.artifactId : (builder.base != null ? builder.base.artifactId : null);
189 this.version = builder.version != null ? builder.version : (builder.base != null ? builder.base.version : null);
190 this.packaging = builder.packaging != null ? builder.packaging : (builder.base != null ? builder.base.packaging : null);
191 this.name = builder.name != null ? builder.name : (builder.base != null ? builder.base.name : null);
192 this.description = builder.description != null ? builder.description : (builder.base != null ? builder.base.description : null);
193 this.url = builder.url != null ? builder.url : (builder.base != null ? builder.base.url : null);
194 this.childProjectUrlInheritAppendPath = builder.childProjectUrlInheritAppendPath != null ? builder.childProjectUrlInheritAppendPath : (builder.base != null ? builder.base.childProjectUrlInheritAppendPath : null);
195 this.root = builder.root != null ? builder.root : (builder.base != null ? builder.base.root : false);
196 this.preserveModelVersion = builder.preserveModelVersion != null ? builder.preserveModelVersion : (builder.base != null ? builder.base.preserveModelVersion : false);
197 this.inceptionYear = builder.inceptionYear != null ? builder.inceptionYear : (builder.base != null ? builder.base.inceptionYear : null);
198 this.organization = builder.organization != null ? builder.organization : (builder.base != null ? builder.base.organization : null);
199 this.licenses = ImmutableCollections.copy(builder.licenses != null ? builder.licenses : (builder.base != null ? builder.base.licenses : null));
200 this.developers = ImmutableCollections.copy(builder.developers != null ? builder.developers : (builder.base != null ? builder.base.developers : null));
201 this.contributors = ImmutableCollections.copy(builder.contributors != null ? builder.contributors : (builder.base != null ? builder.base.contributors : null));
202 this.mailingLists = ImmutableCollections.copy(builder.mailingLists != null ? builder.mailingLists : (builder.base != null ? builder.base.mailingLists : null));
203 this.prerequisites = builder.prerequisites != null ? builder.prerequisites : (builder.base != null ? builder.base.prerequisites : null);
204 this.scm = builder.scm != null ? builder.scm : (builder.base != null ? builder.base.scm : null);
205 this.issueManagement = builder.issueManagement != null ? builder.issueManagement : (builder.base != null ? builder.base.issueManagement : null);
206 this.ciManagement = builder.ciManagement != null ? builder.ciManagement : (builder.base != null ? builder.base.ciManagement : null);
207 this.build = builder.build != null ? builder.build : (builder.base != null ? builder.base.build : null);
208 this.profiles = ImmutableCollections.copy(builder.profiles != null ? builder.profiles : (builder.base != null ? builder.base.profiles : null));
209 Map<Object, InputLocation> newlocs = builder.locations != null ? builder.locations : Collections.emptyMap();
210 Map<Object, InputLocation> oldlocs = builder.base != null && builder.base.locations != null ? builder.base.locations : Collections.emptyMap();
211 Map<Object, InputLocation> mutableLocations = new HashMap<>(super.locations);
212 mutableLocations.put("pomFile", newlocs.containsKey("pomFile") ? newlocs.get("pomFile") : oldlocs.get("pomFile"));
213 mutableLocations.put("modelVersion", newlocs.containsKey("modelVersion") ? newlocs.get("modelVersion") : oldlocs.get("modelVersion"));
214 mutableLocations.put("parent", newlocs.containsKey("parent") ? newlocs.get("parent") : oldlocs.get("parent"));
215 mutableLocations.put("groupId", newlocs.containsKey("groupId") ? newlocs.get("groupId") : oldlocs.get("groupId"));
216 mutableLocations.put("artifactId", newlocs.containsKey("artifactId") ? newlocs.get("artifactId") : oldlocs.get("artifactId"));
217 mutableLocations.put("version", newlocs.containsKey("version") ? newlocs.get("version") : oldlocs.get("version"));
218 mutableLocations.put("packaging", newlocs.containsKey("packaging") ? newlocs.get("packaging") : oldlocs.get("packaging"));
219 mutableLocations.put("name", newlocs.containsKey("name") ? newlocs.get("name") : oldlocs.get("name"));
220 mutableLocations.put("description", newlocs.containsKey("description") ? newlocs.get("description") : oldlocs.get("description"));
221 mutableLocations.put("url", newlocs.containsKey("url") ? newlocs.get("url") : oldlocs.get("url"));
222 mutableLocations.put("childProjectUrlInheritAppendPath", newlocs.containsKey("childProjectUrlInheritAppendPath") ? newlocs.get("childProjectUrlInheritAppendPath") : oldlocs.get("childProjectUrlInheritAppendPath"));
223 mutableLocations.put("root", newlocs.containsKey("root") ? newlocs.get("root") : oldlocs.get("root"));
224 mutableLocations.put("preserveModelVersion", newlocs.containsKey("preserveModelVersion") ? newlocs.get("preserveModelVersion") : oldlocs.get("preserveModelVersion"));
225 mutableLocations.put("inceptionYear", newlocs.containsKey("inceptionYear") ? newlocs.get("inceptionYear") : oldlocs.get("inceptionYear"));
226 mutableLocations.put("organization", newlocs.containsKey("organization") ? newlocs.get("organization") : oldlocs.get("organization"));
227 mutableLocations.put("licenses", newlocs.containsKey("licenses") ? newlocs.get("licenses") : oldlocs.get("licenses"));
228 mutableLocations.put("developers", newlocs.containsKey("developers") ? newlocs.get("developers") : oldlocs.get("developers"));
229 mutableLocations.put("contributors", newlocs.containsKey("contributors") ? newlocs.get("contributors") : oldlocs.get("contributors"));
230 mutableLocations.put("mailingLists", newlocs.containsKey("mailingLists") ? newlocs.get("mailingLists") : oldlocs.get("mailingLists"));
231 mutableLocations.put("prerequisites", newlocs.containsKey("prerequisites") ? newlocs.get("prerequisites") : oldlocs.get("prerequisites"));
232 mutableLocations.put("scm", newlocs.containsKey("scm") ? newlocs.get("scm") : oldlocs.get("scm"));
233 mutableLocations.put("issueManagement", newlocs.containsKey("issueManagement") ? newlocs.get("issueManagement") : oldlocs.get("issueManagement"));
234 mutableLocations.put("ciManagement", newlocs.containsKey("ciManagement") ? newlocs.get("ciManagement") : oldlocs.get("ciManagement"));
235 mutableLocations.put("build", newlocs.containsKey("build") ? newlocs.get("build") : oldlocs.get("build"));
236 mutableLocations.put("profiles", newlocs.containsKey("profiles") ? newlocs.get("profiles") : oldlocs.get("profiles"));
237 this.locations = Collections.unmodifiableMap(mutableLocations);
238 }
239
240 public String getNamespaceUri() {
241 return namespaceUri;
242 }
243
244 public String getModelEncoding() {
245 return modelEncoding;
246 }
247
248
249
250
251
252
253 public Path getPomFile() {
254 return this.pomFile;
255 }
256
257
258
259
260
261
262 public String getModelVersion() {
263 return this.modelVersion;
264 }
265
266
267
268
269
270
271
272
273 public Parent getParent() {
274 return this.parent;
275 }
276
277
278
279
280
281
282
283
284 public String getGroupId() {
285 return this.groupId;
286 }
287
288
289
290
291
292
293
294
295
296 public String getArtifactId() {
297 return this.artifactId;
298 }
299
300
301
302
303
304
305 public String getVersion() {
306 return this.version;
307 }
308
309
310
311
312
313
314
315
316
317
318
319
320 public String getPackaging() {
321 return this.packaging;
322 }
323
324
325
326
327
328
329 public String getName() {
330 return this.name;
331 }
332
333
334
335
336
337
338
339
340
341
342 public String getDescription() {
343 return this.description;
344 }
345
346
347
348
349
350
351
352
353 public String getUrl() {
354 return this.url;
355 }
356
357
358
359
360
361
362
363
364
365
366 public String getChildProjectUrlInheritAppendPath() {
367 return this.childProjectUrlInheritAppendPath;
368 }
369
370
371
372
373
374
375
376
377
378 public boolean isRoot() {
379 return this.root;
380 }
381
382
383
384
385
386
387
388
389 public boolean isPreserveModelVersion() {
390 return this.preserveModelVersion;
391 }
392
393
394
395
396
397
398
399 public String getInceptionYear() {
400 return this.inceptionYear;
401 }
402
403
404
405
406
407
408
409
410 public Organization getOrganization() {
411 return this.organization;
412 }
413
414
415
416
417
418
419
420
421
422
423
424
425 @Nonnull
426 public List<License> getLicenses() {
427 return this.licenses;
428 }
429
430
431
432
433
434
435 @Nonnull
436 public List<Developer> getDevelopers() {
437 return this.developers;
438 }
439
440
441
442
443
444
445 @Nonnull
446 public List<Contributor> getContributors() {
447 return this.contributors;
448 }
449
450
451
452
453
454
455 @Nonnull
456 public List<MailingList> getMailingLists() {
457 return this.mailingLists;
458 }
459
460
461
462
463
464
465 public Prerequisites getPrerequisites() {
466 return this.prerequisites;
467 }
468
469
470
471
472
473
474 public Scm getScm() {
475 return this.scm;
476 }
477
478
479
480
481
482
483 public IssueManagement getIssueManagement() {
484 return this.issueManagement;
485 }
486
487
488
489
490
491
492 public CiManagement getCiManagement() {
493 return this.ciManagement;
494 }
495
496
497
498
499
500
501 public Build getBuild() {
502 return this.build;
503 }
504
505
506
507
508
509
510
511 @Nonnull
512 public List<Profile> getProfiles() {
513 return this.profiles;
514 }
515
516
517
518
519 public InputLocation getLocation(Object key) {
520 return locations != null ? locations.get(key) : null;
521 }
522
523
524
525
526 public Set<Object> getLocationKeys() {
527 return locations != null ? locations.keySet() : null;
528 }
529
530
531
532
533
534
535 @Nonnull
536 public Builder with() {
537 return newBuilder(this);
538 }
539
540
541
542
543
544
545 @Deprecated
546 @Nonnull
547 public Model withModules(Collection<String> modules) {
548 return newBuilder(this, true).modules(modules).build();
549 }
550
551
552
553
554
555
556 @Nonnull
557 public Model withSubprojects(Collection<String> subprojects) {
558 return newBuilder(this, true).subprojects(subprojects).build();
559 }
560
561
562
563
564
565
566 @Nonnull
567 public Model withDistributionManagement(DistributionManagement distributionManagement) {
568 return newBuilder(this, true).distributionManagement(distributionManagement).build();
569 }
570
571
572
573
574
575
576 @Nonnull
577 public Model withProperties(Map<String, String> properties) {
578 return newBuilder(this, true).properties(properties).build();
579 }
580
581
582
583
584
585
586 @Nonnull
587 public Model withDependencyManagement(DependencyManagement dependencyManagement) {
588 return newBuilder(this, true).dependencyManagement(dependencyManagement).build();
589 }
590
591
592
593
594
595
596 @Nonnull
597 public Model withDependencies(Collection<Dependency> dependencies) {
598 return newBuilder(this, true).dependencies(dependencies).build();
599 }
600
601
602
603
604
605
606 @Nonnull
607 public Model withRepositories(Collection<Repository> repositories) {
608 return newBuilder(this, true).repositories(repositories).build();
609 }
610
611
612
613
614
615
616 @Nonnull
617 public Model withPluginRepositories(Collection<Repository> pluginRepositories) {
618 return newBuilder(this, true).pluginRepositories(pluginRepositories).build();
619 }
620
621
622
623
624
625
626 @Nonnull
627 public Model withReporting(Reporting reporting) {
628 return newBuilder(this, true).reporting(reporting).build();
629 }
630
631
632
633
634
635
636 @Nonnull
637 public Model withPomFile(Path pomFile) {
638 return newBuilder(this, true).pomFile(pomFile).build();
639 }
640
641
642
643
644
645
646 @Nonnull
647 public Model withModelVersion(String modelVersion) {
648 return newBuilder(this, true).modelVersion(modelVersion).build();
649 }
650
651
652
653
654
655
656 @Nonnull
657 public Model withParent(Parent parent) {
658 return newBuilder(this, true).parent(parent).build();
659 }
660
661
662
663
664
665
666 @Nonnull
667 public Model withGroupId(String groupId) {
668 return newBuilder(this, true).groupId(groupId).build();
669 }
670
671
672
673
674
675
676 @Nonnull
677 public Model withArtifactId(String artifactId) {
678 return newBuilder(this, true).artifactId(artifactId).build();
679 }
680
681
682
683
684
685
686 @Nonnull
687 public Model withVersion(String version) {
688 return newBuilder(this, true).version(version).build();
689 }
690
691
692
693
694
695
696 @Nonnull
697 public Model withPackaging(String packaging) {
698 return newBuilder(this, true).packaging(packaging).build();
699 }
700
701
702
703
704
705
706 @Nonnull
707 public Model withName(String name) {
708 return newBuilder(this, true).name(name).build();
709 }
710
711
712
713
714
715
716 @Nonnull
717 public Model withDescription(String description) {
718 return newBuilder(this, true).description(description).build();
719 }
720
721
722
723
724
725
726 @Nonnull
727 public Model withUrl(String url) {
728 return newBuilder(this, true).url(url).build();
729 }
730
731
732
733
734
735
736 @Nonnull
737 public Model withChildProjectUrlInheritAppendPath(String childProjectUrlInheritAppendPath) {
738 return newBuilder(this, true).childProjectUrlInheritAppendPath(childProjectUrlInheritAppendPath).build();
739 }
740
741
742
743
744
745
746 @Nonnull
747 public Model withRoot(boolean root) {
748 return newBuilder(this, true).root(root).build();
749 }
750
751
752
753
754
755
756 @Nonnull
757 public Model withPreserveModelVersion(boolean preserveModelVersion) {
758 return newBuilder(this, true).preserveModelVersion(preserveModelVersion).build();
759 }
760
761
762
763
764
765
766 @Nonnull
767 public Model withInceptionYear(String inceptionYear) {
768 return newBuilder(this, true).inceptionYear(inceptionYear).build();
769 }
770
771
772
773
774
775
776 @Nonnull
777 public Model withOrganization(Organization organization) {
778 return newBuilder(this, true).organization(organization).build();
779 }
780
781
782
783
784
785
786 @Nonnull
787 public Model withLicenses(Collection<License> licenses) {
788 return newBuilder(this, true).licenses(licenses).build();
789 }
790
791
792
793
794
795
796 @Nonnull
797 public Model withDevelopers(Collection<Developer> developers) {
798 return newBuilder(this, true).developers(developers).build();
799 }
800
801
802
803
804
805
806 @Nonnull
807 public Model withContributors(Collection<Contributor> contributors) {
808 return newBuilder(this, true).contributors(contributors).build();
809 }
810
811
812
813
814
815
816 @Nonnull
817 public Model withMailingLists(Collection<MailingList> mailingLists) {
818 return newBuilder(this, true).mailingLists(mailingLists).build();
819 }
820
821
822
823
824
825
826 @Nonnull
827 public Model withPrerequisites(Prerequisites prerequisites) {
828 return newBuilder(this, true).prerequisites(prerequisites).build();
829 }
830
831
832
833
834
835
836 @Nonnull
837 public Model withScm(Scm scm) {
838 return newBuilder(this, true).scm(scm).build();
839 }
840
841
842
843
844
845
846 @Nonnull
847 public Model withIssueManagement(IssueManagement issueManagement) {
848 return newBuilder(this, true).issueManagement(issueManagement).build();
849 }
850
851
852
853
854
855
856 @Nonnull
857 public Model withCiManagement(CiManagement ciManagement) {
858 return newBuilder(this, true).ciManagement(ciManagement).build();
859 }
860
861
862
863
864
865
866 @Nonnull
867 public Model withBuild(Build build) {
868 return newBuilder(this, true).build(build).build();
869 }
870
871
872
873
874
875
876 @Nonnull
877 public Model withProfiles(Collection<Profile> profiles) {
878 return newBuilder(this, true).profiles(profiles).build();
879 }
880
881
882
883
884
885
886
887
888 @Nonnull
889 public static Model newInstance() {
890 return newInstance(true);
891 }
892
893
894
895
896
897
898
899
900 @Nonnull
901 public static Model newInstance(boolean withDefaults) {
902 return newBuilder(withDefaults).build();
903 }
904
905
906
907
908
909
910
911
912 @Nonnull
913 public static Builder newBuilder() {
914 return newBuilder(true);
915 }
916
917
918
919
920
921
922
923 @Nonnull
924 public static Builder newBuilder(boolean withDefaults) {
925 return new Builder(withDefaults);
926 }
927
928
929
930
931
932
933
934
935 @Nonnull
936 public static Builder newBuilder(Model from) {
937 return newBuilder(from, false);
938 }
939
940
941
942
943
944
945
946
947 @Nonnull
948 public static Builder newBuilder(Model from, boolean forceCopy) {
949 return new Builder(from, forceCopy);
950 }
951
952
953
954
955
956
957 @NotThreadSafe
958 public static class Builder
959 extends ModelBase.Builder
960 {
961 Model base;
962 String namespaceUri;
963 String modelEncoding;
964 Path pomFile;
965 String modelVersion;
966 Parent parent;
967 String groupId;
968 String artifactId;
969 String version;
970 String packaging;
971 String name;
972 String description;
973 String url;
974 String childProjectUrlInheritAppendPath;
975 Boolean root;
976 Boolean preserveModelVersion;
977 String inceptionYear;
978 Organization organization;
979 Collection<License> licenses;
980 Collection<Developer> developers;
981 Collection<Contributor> contributors;
982 Collection<MailingList> mailingLists;
983 Prerequisites prerequisites;
984 Scm scm;
985 IssueManagement issueManagement;
986 CiManagement ciManagement;
987 Build build;
988 Collection<Profile> profiles;
989
990 protected Builder(boolean withDefaults) {
991 super(withDefaults);
992 if (withDefaults) {
993 this.packaging = "jar";
994 this.root = false;
995 this.preserveModelVersion = false;
996 }
997 }
998
999 protected Builder(Model base, boolean forceCopy) {
1000 super(base, forceCopy);
1001 this.namespaceUri = base.namespaceUri;
1002 this.modelEncoding = base.modelEncoding;
1003 if (forceCopy) {
1004 this.pomFile = base.pomFile;
1005 this.modelVersion = base.modelVersion;
1006 this.parent = base.parent;
1007 this.groupId = base.groupId;
1008 this.artifactId = base.artifactId;
1009 this.version = base.version;
1010 this.packaging = base.packaging;
1011 this.name = base.name;
1012 this.description = base.description;
1013 this.url = base.url;
1014 this.childProjectUrlInheritAppendPath = base.childProjectUrlInheritAppendPath;
1015 this.root = base.root;
1016 this.preserveModelVersion = base.preserveModelVersion;
1017 this.inceptionYear = base.inceptionYear;
1018 this.organization = base.organization;
1019 this.licenses = base.licenses;
1020 this.developers = base.developers;
1021 this.contributors = base.contributors;
1022 this.mailingLists = base.mailingLists;
1023 this.prerequisites = base.prerequisites;
1024 this.scm = base.scm;
1025 this.issueManagement = base.issueManagement;
1026 this.ciManagement = base.ciManagement;
1027 this.build = base.build;
1028 this.profiles = base.profiles;
1029 this.locations = base.locations;
1030 this.importedFrom = base.importedFrom;
1031 } else {
1032 this.base = base;
1033 }
1034 }
1035
1036 @Nonnull
1037 public Builder namespaceUri(String namespaceUri) {
1038 this.namespaceUri = namespaceUri;
1039 return this;
1040 }
1041
1042 @Nonnull
1043 public Builder modelEncoding(String modelEncoding) {
1044 this.modelEncoding = modelEncoding;
1045 return this;
1046 }
1047
1048 @Deprecated
1049 @Nonnull
1050 public Builder modules(Collection<String> modules) {
1051 this.modules = modules;
1052 return this;
1053 }
1054
1055 @Nonnull
1056 public Builder subprojects(Collection<String> subprojects) {
1057 this.subprojects = subprojects;
1058 return this;
1059 }
1060
1061 @Nonnull
1062 public Builder distributionManagement(DistributionManagement distributionManagement) {
1063 this.distributionManagement = distributionManagement;
1064 return this;
1065 }
1066
1067 @Nonnull
1068 public Builder properties(Map<String, String> properties) {
1069 this.properties = properties;
1070 return this;
1071 }
1072
1073 @Nonnull
1074 public Builder dependencyManagement(DependencyManagement dependencyManagement) {
1075 this.dependencyManagement = dependencyManagement;
1076 return this;
1077 }
1078
1079 @Nonnull
1080 public Builder dependencies(Collection<Dependency> dependencies) {
1081 this.dependencies = dependencies;
1082 return this;
1083 }
1084
1085 @Nonnull
1086 public Builder repositories(Collection<Repository> repositories) {
1087 this.repositories = repositories;
1088 return this;
1089 }
1090
1091 @Nonnull
1092 public Builder pluginRepositories(Collection<Repository> pluginRepositories) {
1093 this.pluginRepositories = pluginRepositories;
1094 return this;
1095 }
1096
1097 @Nonnull
1098 public Builder reporting(Reporting reporting) {
1099 this.reporting = reporting;
1100 return this;
1101 }
1102
1103 @Nonnull
1104 public Builder pomFile(Path pomFile) {
1105 this.pomFile = pomFile;
1106 return this;
1107 }
1108
1109 @Nonnull
1110 public Builder modelVersion(String modelVersion) {
1111 this.modelVersion = modelVersion;
1112 return this;
1113 }
1114
1115 @Nonnull
1116 public Builder parent(Parent parent) {
1117 this.parent = parent;
1118 return this;
1119 }
1120
1121 @Nonnull
1122 public Builder groupId(String groupId) {
1123 this.groupId = groupId;
1124 return this;
1125 }
1126
1127 @Nonnull
1128 public Builder artifactId(String artifactId) {
1129 this.artifactId = artifactId;
1130 return this;
1131 }
1132
1133 @Nonnull
1134 public Builder version(String version) {
1135 this.version = version;
1136 return this;
1137 }
1138
1139 @Nonnull
1140 public Builder packaging(String packaging) {
1141 this.packaging = packaging;
1142 return this;
1143 }
1144
1145 @Nonnull
1146 public Builder name(String name) {
1147 this.name = name;
1148 return this;
1149 }
1150
1151 @Nonnull
1152 public Builder description(String description) {
1153 this.description = description;
1154 return this;
1155 }
1156
1157 @Nonnull
1158 public Builder url(String url) {
1159 this.url = url;
1160 return this;
1161 }
1162
1163 @Nonnull
1164 public Builder childProjectUrlInheritAppendPath(String childProjectUrlInheritAppendPath) {
1165 this.childProjectUrlInheritAppendPath = childProjectUrlInheritAppendPath;
1166 return this;
1167 }
1168
1169 @Nonnull
1170 public Builder root(boolean root) {
1171 this.root = root;
1172 return this;
1173 }
1174
1175 @Nonnull
1176 public Builder preserveModelVersion(boolean preserveModelVersion) {
1177 this.preserveModelVersion = preserveModelVersion;
1178 return this;
1179 }
1180
1181 @Nonnull
1182 public Builder inceptionYear(String inceptionYear) {
1183 this.inceptionYear = inceptionYear;
1184 return this;
1185 }
1186
1187 @Nonnull
1188 public Builder organization(Organization organization) {
1189 this.organization = organization;
1190 return this;
1191 }
1192
1193 @Nonnull
1194 public Builder licenses(Collection<License> licenses) {
1195 this.licenses = licenses;
1196 return this;
1197 }
1198
1199 @Nonnull
1200 public Builder developers(Collection<Developer> developers) {
1201 this.developers = developers;
1202 return this;
1203 }
1204
1205 @Nonnull
1206 public Builder contributors(Collection<Contributor> contributors) {
1207 this.contributors = contributors;
1208 return this;
1209 }
1210
1211 @Nonnull
1212 public Builder mailingLists(Collection<MailingList> mailingLists) {
1213 this.mailingLists = mailingLists;
1214 return this;
1215 }
1216
1217 @Nonnull
1218 public Builder prerequisites(Prerequisites prerequisites) {
1219 this.prerequisites = prerequisites;
1220 return this;
1221 }
1222
1223 @Nonnull
1224 public Builder scm(Scm scm) {
1225 this.scm = scm;
1226 return this;
1227 }
1228
1229 @Nonnull
1230 public Builder issueManagement(IssueManagement issueManagement) {
1231 this.issueManagement = issueManagement;
1232 return this;
1233 }
1234
1235 @Nonnull
1236 public Builder ciManagement(CiManagement ciManagement) {
1237 this.ciManagement = ciManagement;
1238 return this;
1239 }
1240
1241 @Nonnull
1242 public Builder build(Build build) {
1243 this.build = build;
1244 return this;
1245 }
1246
1247 @Nonnull
1248 public Builder profiles(Collection<Profile> profiles) {
1249 this.profiles = profiles;
1250 return this;
1251 }
1252
1253
1254 @Nonnull
1255 public Builder location(Object key, InputLocation location) {
1256 if (location != null) {
1257 if (!(this.locations instanceof HashMap)) {
1258 this.locations = this.locations != null ? new HashMap<>(this.locations) : new HashMap<>();
1259 }
1260 this.locations.put(key, location);
1261 }
1262 return this;
1263 }
1264
1265 @Nonnull
1266 public Builder importedFrom(InputLocation importedFrom) {
1267 this.importedFrom = importedFrom;
1268 return this;
1269 }
1270
1271 @Nonnull
1272 public Model build() {
1273
1274 if (base != null
1275 && (modules == null || modules == base.modules)
1276 && (subprojects == null || subprojects == base.subprojects)
1277 && (distributionManagement == null || distributionManagement == base.distributionManagement)
1278 && (properties == null || properties == base.properties)
1279 && (dependencyManagement == null || dependencyManagement == base.dependencyManagement)
1280 && (dependencies == null || dependencies == base.dependencies)
1281 && (repositories == null || repositories == base.repositories)
1282 && (pluginRepositories == null || pluginRepositories == base.pluginRepositories)
1283 && (reporting == null || reporting == base.reporting)
1284 && (pomFile == null || pomFile == base.pomFile)
1285 && (modelVersion == null || modelVersion == base.modelVersion)
1286 && (parent == null || parent == base.parent)
1287 && (groupId == null || groupId == base.groupId)
1288 && (artifactId == null || artifactId == base.artifactId)
1289 && (version == null || version == base.version)
1290 && (packaging == null || packaging == base.packaging)
1291 && (name == null || name == base.name)
1292 && (description == null || description == base.description)
1293 && (url == null || url == base.url)
1294 && (childProjectUrlInheritAppendPath == null || childProjectUrlInheritAppendPath == base.childProjectUrlInheritAppendPath)
1295 && (root == null || root == base.root)
1296 && (preserveModelVersion == null || preserveModelVersion == base.preserveModelVersion)
1297 && (inceptionYear == null || inceptionYear == base.inceptionYear)
1298 && (organization == null || organization == base.organization)
1299 && (licenses == null || licenses == base.licenses)
1300 && (developers == null || developers == base.developers)
1301 && (contributors == null || contributors == base.contributors)
1302 && (mailingLists == null || mailingLists == base.mailingLists)
1303 && (prerequisites == null || prerequisites == base.prerequisites)
1304 && (scm == null || scm == base.scm)
1305 && (issueManagement == null || issueManagement == base.issueManagement)
1306 && (ciManagement == null || ciManagement == base.ciManagement)
1307 && (build == null || build == base.build)
1308 && (profiles == null || profiles == base.profiles)
1309 ) {
1310 return base;
1311 }
1312 return new Model(this);
1313 }
1314 }
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324 public Path getProjectDirectory() {
1325 return (pomFile != null) ? pomFile.getParent() : null;
1326 }
1327
1328
1329
1330
1331 public String getId()
1332 {
1333 StringBuilder id = new StringBuilder( 64 );
1334
1335 id.append( ( getGroupId() == null ) ? "[inherited]" : getGroupId() );
1336 id.append( ":" );
1337 id.append( getArtifactId() );
1338 id.append( ":" );
1339 id.append( getPackaging() );
1340 id.append( ":" );
1341 id.append( ( getVersion() == null ) ? "[inherited]" : getVersion() );
1342
1343 return id.toString();
1344 }
1345
1346 @Override
1347 public String toString()
1348 {
1349 return getId();
1350 }
1351
1352 public boolean isChildProjectUrlInheritAppendPath()
1353 {
1354 return ( getChildProjectUrlInheritAppendPath() != null ) ? Boolean.parseBoolean( getChildProjectUrlInheritAppendPath() ) : true;
1355 }
1356
1357
1358
1359 }