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