1
2
3
4
5 package org.apache.maven.model;
6
7 import java.io.Serializable;
8 import java.util.AbstractList;
9 import java.util.Collections;
10 import java.util.HashMap;
11 import java.util.List;
12 import java.util.Map;
13 import java.util.Objects;
14 import java.util.stream.Collectors;
15 import java.util.stream.Stream;
16 import org.apache.maven.api.annotations.Generated;
17 import org.apache.maven.api.annotations.Nonnull;
18
19 @Generated
20 public class DistributionManagement
21 extends BaseObject
22 {
23
24 public DistributionManagement() {
25 this(org.apache.maven.api.model.DistributionManagement.newInstance());
26 }
27
28 public DistributionManagement(org.apache.maven.api.model.DistributionManagement delegate) {
29 this(delegate, null);
30 }
31
32 public DistributionManagement(org.apache.maven.api.model.DistributionManagement delegate, BaseObject parent) {
33 super(delegate, parent);
34 }
35
36 public DistributionManagement clone(){
37 return new DistributionManagement(getDelegate());
38 }
39
40 public org.apache.maven.api.model.DistributionManagement getDelegate() {
41 return (org.apache.maven.api.model.DistributionManagement) super.getDelegate();
42 }
43
44 @Override
45 public boolean equals(Object o) {
46 if (this == o) {
47 return true;
48 }
49 if (o == null || !(o instanceof DistributionManagement)) {
50 return false;
51 }
52 DistributionManagement that = (DistributionManagement) o;
53 return Objects.equals(this.delegate, that.delegate);
54 }
55
56 @Override
57 public int hashCode() {
58 return getDelegate().hashCode();
59 }
60
61 public DeploymentRepository getRepository() {
62 return getDelegate().getRepository() != null ? new DeploymentRepository(getDelegate().getRepository(), this) : null;
63 }
64
65 public void setRepository(DeploymentRepository repository) {
66 if (!Objects.equals(repository, getRepository())){
67 if (repository != null) {
68 update(getDelegate().withRepository(repository.getDelegate()));
69 repository.childrenTracking = this::replace;
70 } else {
71 update(getDelegate().withRepository(null));
72 }
73 }
74 }
75
76 public DeploymentRepository getSnapshotRepository() {
77 return getDelegate().getSnapshotRepository() != null ? new DeploymentRepository(getDelegate().getSnapshotRepository(), this) : null;
78 }
79
80 public void setSnapshotRepository(DeploymentRepository snapshotRepository) {
81 if (!Objects.equals(snapshotRepository, getSnapshotRepository())){
82 if (snapshotRepository != null) {
83 update(getDelegate().withSnapshotRepository(snapshotRepository.getDelegate()));
84 snapshotRepository.childrenTracking = this::replace;
85 } else {
86 update(getDelegate().withSnapshotRepository(null));
87 }
88 }
89 }
90
91 public Site getSite() {
92 return getDelegate().getSite() != null ? new Site(getDelegate().getSite(), this) : null;
93 }
94
95 public void setSite(Site site) {
96 if (!Objects.equals(site, getSite())){
97 if (site != null) {
98 update(getDelegate().withSite(site.getDelegate()));
99 site.childrenTracking = this::replace;
100 } else {
101 update(getDelegate().withSite(null));
102 }
103 }
104 }
105
106 public String getDownloadUrl() {
107 return getDelegate().getDownloadUrl();
108 }
109
110 public void setDownloadUrl(String downloadUrl) {
111 if (!Objects.equals(downloadUrl, getDownloadUrl())) {
112 update(getDelegate().withDownloadUrl(downloadUrl));
113 }
114 }
115
116 public Relocation getRelocation() {
117 return getDelegate().getRelocation() != null ? new Relocation(getDelegate().getRelocation(), this) : null;
118 }
119
120 public void setRelocation(Relocation relocation) {
121 if (!Objects.equals(relocation, getRelocation())){
122 if (relocation != null) {
123 update(getDelegate().withRelocation(relocation.getDelegate()));
124 relocation.childrenTracking = this::replace;
125 } else {
126 update(getDelegate().withRelocation(null));
127 }
128 }
129 }
130
131 public String getStatus() {
132 return getDelegate().getStatus();
133 }
134
135 public void setStatus(String status) {
136 if (!Objects.equals(status, getStatus())) {
137 update(getDelegate().withStatus(status));
138 }
139 }
140
141 public InputLocation getLocation(Object key) {
142 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
143 return loc != null ? new InputLocation(loc) : null;
144 }
145
146 public void setLocation(Object key, InputLocation location) {
147 update(org.apache.maven.api.model.DistributionManagement.newBuilder(getDelegate(), true)
148 .location(key, location.toApiLocation()).build());
149 }
150
151 protected boolean replace(Object oldDelegate, Object newDelegate) {
152 if (super.replace(oldDelegate, newDelegate)) {
153 return true;
154 }
155 if (oldDelegate == getDelegate().getRepository()) {
156 update(getDelegate().withRepository((org.apache.maven.api.model.DeploymentRepository) newDelegate));
157 return true;
158 }
159 if (oldDelegate == getDelegate().getSnapshotRepository()) {
160 update(getDelegate().withSnapshotRepository((org.apache.maven.api.model.DeploymentRepository) newDelegate));
161 return true;
162 }
163 if (oldDelegate == getDelegate().getSite()) {
164 update(getDelegate().withSite((org.apache.maven.api.model.Site) newDelegate));
165 return true;
166 }
167 if (oldDelegate == getDelegate().getRelocation()) {
168 update(getDelegate().withRelocation((org.apache.maven.api.model.Relocation) newDelegate));
169 return true;
170 }
171 return false;
172 }
173
174 public static List<org.apache.maven.api.model.DistributionManagement> distributionManagementToApiV4(List<DistributionManagement> list) {
175 return list != null ? new WrapperList<>(list, DistributionManagement::getDelegate, DistributionManagement::new) : null;
176 }
177
178 public static List<DistributionManagement> distributionManagementToApiV3(List<org.apache.maven.api.model.DistributionManagement> list) {
179 return list != null ? new WrapperList<>(list, DistributionManagement::new, DistributionManagement::getDelegate) : null;
180 }
181
182 }