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