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