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