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 Activation
20      extends BaseObject
21  {
22  
23      public Activation()
24      {
25          this( org.apache.maven.api.model.Activation.newInstance() );
26      }
27  
28      public Activation( org.apache.maven.api.model.Activation delegate )
29      {
30          this( delegate, null );
31      }
32  
33      public Activation( org.apache.maven.api.model.Activation delegate, BaseObject parent )
34      {
35          super( delegate, parent );
36      }
37  
38      public Activation clone()
39      {
40          return new Activation( getDelegate() );
41      }
42  
43      public org.apache.maven.api.model.Activation getDelegate()
44      {
45          return ( org.apache.maven.api.model.Activation ) super.getDelegate();
46      }
47  
48      public boolean isActiveByDefault()
49      {
50          return getDelegate().isActiveByDefault();
51      }
52  
53      public void setActiveByDefault( boolean activeByDefault )
54      {
55          if ( !Objects.equals( activeByDefault, getDelegate().isActiveByDefault() ) )
56          {
57              update( getDelegate().withActiveByDefault( activeByDefault ) );
58          }
59      }
60  
61      public String getJdk()
62      {
63          return getDelegate().getJdk();
64      }
65  
66      public void setJdk( String jdk )
67      {
68          if ( !Objects.equals( jdk, getDelegate().getJdk() ) )
69          {
70              update( getDelegate().withJdk( jdk ) );
71          }
72      }
73  
74      public ActivationOS getOs()
75      {
76          return getDelegate().getOs() != null ? new ActivationOS( getDelegate().getOs(), this ) : null;
77      }
78  
79      public void setOs( ActivationOS os )
80      {
81          if ( !Objects.equals( os, getDelegate().getOs() ) )
82          {
83              update( getDelegate().withOs( os.getDelegate() ) );
84              os.childrenTracking = this::replace;
85          }
86      }
87  
88      public ActivationProperty getProperty()
89      {
90          return getDelegate().getProperty() != null ? new ActivationProperty( getDelegate().getProperty(), this ) : null;
91      }
92  
93      public void setProperty( ActivationProperty property )
94      {
95          if ( !Objects.equals( property, getDelegate().getProperty() ) )
96          {
97              update( getDelegate().withProperty( property.getDelegate() ) );
98              property.childrenTracking = this::replace;
99          }
100     }
101 
102     public ActivationFile getFile()
103     {
104         return getDelegate().getFile() != null ? new ActivationFile( getDelegate().getFile(), this ) : null;
105     }
106 
107     public void setFile( ActivationFile file )
108     {
109         if ( !Objects.equals( file, getDelegate().getFile() ) )
110         {
111             update( getDelegate().withFile( file.getDelegate() ) );
112             file.childrenTracking = this::replace;
113         }
114     }
115 
116     public InputLocation getLocation( Object key )
117     {
118         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
119         return loc != null ? new InputLocation( loc ) : null;
120     }
121 
122     public void setLocation( Object key, InputLocation location )
123     {
124         update( org.apache.maven.api.model.Activation.newBuilder( getDelegate(), true )
125                         .location( key, location.toApiLocation() ).build() );
126     }
127 
128     protected boolean replace( Object oldDelegate, Object newDelegate )
129     {
130         if ( super.replace( oldDelegate, newDelegate ) )
131         {
132             return true;
133         }
134         if ( oldDelegate == getDelegate().getOs() )
135         {
136             update( getDelegate().withOs( ( org.apache.maven.api.model.ActivationOS ) newDelegate ) );
137             return true;
138         }
139         if ( oldDelegate == getDelegate().getProperty() )
140         {
141             update( getDelegate().withProperty( ( org.apache.maven.api.model.ActivationProperty ) newDelegate ) );
142             return true;
143         }
144         if ( oldDelegate == getDelegate().getFile() )
145         {
146             update( getDelegate().withFile( ( org.apache.maven.api.model.ActivationFile ) newDelegate ) );
147             return true;
148         }
149         return false;
150     }
151 
152     public static List<org.apache.maven.api.model.Activation> activationToApiV4( List<Activation> list )
153     {
154         return list != null ? new WrapperList<>( list, Activation::getDelegate, Activation::new ) : null;
155     }
156 
157     public static List<Activation> activationToApiV3( List<org.apache.maven.api.model.Activation> list )
158     {
159         return list != null ? new WrapperList<>( list, Activation::new, Activation::getDelegate ) : null;
160     }
161 
162 }