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.ArrayList;
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 CiManagement
21      extends BaseObject
22  {
23  
24      public CiManagement()
25      {
26          this( org.apache.maven.api.model.CiManagement.newInstance() );
27      }
28  
29      public CiManagement( org.apache.maven.api.model.CiManagement delegate )
30      {
31          this( delegate, null );
32      }
33  
34      public CiManagement( org.apache.maven.api.model.CiManagement delegate, BaseObject parent )
35      {
36          super( delegate, parent );
37      }
38  
39      public CiManagement clone()
40      {
41          return new CiManagement( getDelegate() );
42      }
43  
44      public org.apache.maven.api.model.CiManagement getDelegate()
45      {
46          return ( org.apache.maven.api.model.CiManagement ) super.getDelegate();
47      }
48  
49      public String getSystem()
50      {
51          return getDelegate().getSystem();
52      }
53  
54      public void setSystem( String system )
55      {
56          if ( !Objects.equals( system, getDelegate().getSystem() ) )
57          {
58              update( getDelegate().withSystem( system ) );
59          }
60      }
61  
62      public String getUrl()
63      {
64          return getDelegate().getUrl();
65      }
66  
67      public void setUrl( String url )
68      {
69          if ( !Objects.equals( url, getDelegate().getUrl() ) )
70          {
71              update( getDelegate().withUrl( url ) );
72          }
73      }
74  
75      @Nonnull
76      public List<Notifier> getNotifiers()
77      {
78          return new WrapperList<Notifier, org.apache.maven.api.model.Notifier>(
79                      () -> getDelegate().getNotifiers(), l -> update( getDelegate().withNotifiers( l ) ),
80                      d -> new Notifier( d, this ), Notifier::getDelegate );
81      }
82  
83      public void setNotifiers( List<Notifier> notifiers )
84      {
85          if ( !Objects.equals( notifiers, getDelegate().getNotifiers() ) )
86          {
87              update( getDelegate().withNotifiers(
88                      notifiers.stream().map( c -> c.getDelegate() ).collect( Collectors.toList() ) ) );
89              notifiers.forEach( e -> e.childrenTracking = this::replace );
90          }
91      }
92  
93      public void addNotifier( Notifier notifier )
94      {
95          update( getDelegate().withNotifiers(
96                  Stream.concat( getDelegate().getNotifiers().stream(), Stream.of( notifier.getDelegate() ) )
97                          .collect( Collectors.toList() ) ) );
98          notifier.childrenTracking = this::replace;
99      }
100 
101     public void removeNotifier( Notifier notifier )
102     {
103         update( getDelegate().withNotifiers(
104                 getDelegate().getNotifiers().stream()
105                         .filter( e -> !Objects.equals( e, notifier ) )
106                         .collect( Collectors.toList() ) ) );
107         notifier.childrenTracking = null;
108     }
109 
110     public InputLocation getLocation( Object key )
111     {
112         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
113         return loc != null ? new InputLocation( loc ) : null;
114     }
115 
116     public void setLocation( Object key, InputLocation location )
117     {
118         update( org.apache.maven.api.model.CiManagement.newBuilder( getDelegate(), true )
119                         .location( key, location.toApiLocation() ).build() );
120     }
121 
122     protected boolean replace( Object oldDelegate, Object newDelegate )
123     {
124         if ( super.replace( oldDelegate, newDelegate ) )
125         {
126             return true;
127         }
128         if ( getDelegate().getNotifiers().contains( oldDelegate ) )
129         {
130             List<org.apache.maven.api.model.Notifier> list = new ArrayList<>( getDelegate().getNotifiers() );
131             list.replaceAll( d -> d == oldDelegate ? ( org.apache.maven.api.model.Notifier ) newDelegate : d );
132             update( getDelegate().withNotifiers( list ) );
133             return true;
134         }
135         return false;
136     }
137 
138     public static List<org.apache.maven.api.model.CiManagement> ciManagementToApiV4( List<CiManagement> list )
139     {
140         return list != null ? new WrapperList<>( list, CiManagement::getDelegate, CiManagement::new ) : null;
141     }
142 
143     public static List<CiManagement> ciManagementToApiV3( List<org.apache.maven.api.model.CiManagement> list )
144     {
145         return list != null ? new WrapperList<>( list, CiManagement::new, CiManagement::getDelegate ) : null;
146     }
147 
148 }