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