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.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              update(getDelegate().withRepository(repository.getDelegate()));
68              repository.childrenTracking = this::replace;
69          }
70      }
71  
72      public DeploymentRepository getSnapshotRepository() {
73          return getDelegate().getSnapshotRepository() != null ? new DeploymentRepository(getDelegate().getSnapshotRepository(), this) : null;
74      }
75  
76      public void setSnapshotRepository(DeploymentRepository snapshotRepository) {
77          if (!Objects.equals(snapshotRepository, getSnapshotRepository())) {
78              update(getDelegate().withSnapshotRepository(snapshotRepository.getDelegate()));
79              snapshotRepository.childrenTracking = this::replace;
80          }
81      }
82  
83      public Site getSite() {
84          return getDelegate().getSite() != null ? new Site(getDelegate().getSite(), this) : null;
85      }
86  
87      public void setSite(Site site) {
88          if (!Objects.equals(site, getSite())) {
89              update(getDelegate().withSite(site.getDelegate()));
90              site.childrenTracking = this::replace;
91          }
92      }
93  
94      public String getDownloadUrl() {
95          return getDelegate().getDownloadUrl();
96      }
97  
98      public void setDownloadUrl(String downloadUrl) {
99          if (!Objects.equals(downloadUrl, getDownloadUrl())) {
100             update(getDelegate().withDownloadUrl(downloadUrl));
101         }
102     }
103 
104     public Relocation getRelocation() {
105         return getDelegate().getRelocation() != null ? new Relocation(getDelegate().getRelocation(), this) : null;
106     }
107 
108     public void setRelocation(Relocation relocation) {
109         if (!Objects.equals(relocation, getRelocation())) {
110             update(getDelegate().withRelocation(relocation.getDelegate()));
111             relocation.childrenTracking = this::replace;
112         }
113     }
114 
115     public String getStatus() {
116         return getDelegate().getStatus();
117     }
118 
119     public void setStatus(String status) {
120         if (!Objects.equals(status, getStatus())) {
121             update(getDelegate().withStatus(status));
122         }
123     }
124 
125     public InputLocation getLocation(Object key) {
126         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
127         return loc != null ? new InputLocation(loc) : null;
128     }
129 
130     public void setLocation(Object key, InputLocation location) {
131         update(org.apache.maven.api.model.DistributionManagement.newBuilder(getDelegate(), true)
132                         .location(key, location.toApiLocation()).build());
133     }
134 
135     protected boolean replace(Object oldDelegate, Object newDelegate) {
136         if (super.replace(oldDelegate, newDelegate)) {
137             return true;
138         }
139         if (oldDelegate == getDelegate().getRepository()) {
140             update(getDelegate().withRepository((org.apache.maven.api.model.DeploymentRepository) newDelegate));
141             return true;
142         }
143         if (oldDelegate == getDelegate().getSnapshotRepository()) {
144             update(getDelegate().withSnapshotRepository((org.apache.maven.api.model.DeploymentRepository) newDelegate));
145             return true;
146         }
147         if (oldDelegate == getDelegate().getSite()) {
148             update(getDelegate().withSite((org.apache.maven.api.model.Site) newDelegate));
149             return true;
150         }
151         if (oldDelegate == getDelegate().getRelocation()) {
152             update(getDelegate().withRelocation((org.apache.maven.api.model.Relocation) newDelegate));
153             return true;
154         }
155         return false;
156     }
157 
158     public static List<org.apache.maven.api.model.DistributionManagement> distributionManagementToApiV4(List<DistributionManagement> list) {
159         return list != null ? new WrapperList<>(list, DistributionManagement::getDelegate, DistributionManagement::new) : null;
160     }
161 
162     public static List<DistributionManagement> distributionManagementToApiV3(List<org.apache.maven.api.model.DistributionManagement> list) {
163         return list != null ? new WrapperList<>(list, DistributionManagement::new, DistributionManagement::getDelegate) : null;
164     }
165 
166 }