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              update(getDelegate().withOs(os.getDelegate()));
88              os.childrenTracking = this::replace;
89          }
90      }
91  
92      public ActivationProperty getProperty() {
93          return getDelegate().getProperty() != null ? new ActivationProperty(getDelegate().getProperty(), this) : null;
94      }
95  
96      public void setProperty(ActivationProperty property) {
97          if (!Objects.equals(property, getProperty())) {
98              update(getDelegate().withProperty(property.getDelegate()));
99              property.childrenTracking = this::replace;
100         }
101     }
102 
103     public ActivationFile getFile() {
104         return getDelegate().getFile() != null ? new ActivationFile(getDelegate().getFile(), this) : null;
105     }
106 
107     public void setFile(ActivationFile file) {
108         if (!Objects.equals(file, getFile())) {
109             update(getDelegate().withFile(file.getDelegate()));
110             file.childrenTracking = this::replace;
111         }
112     }
113 
114     protected boolean replace(Object oldDelegate, Object newDelegate) {
115         if (super.replace(oldDelegate, newDelegate)) {
116             return true;
117         }
118         if (oldDelegate == getDelegate().getOs()) {
119             update(getDelegate().withOs((org.apache.maven.api.settings.ActivationOS) newDelegate));
120             return true;
121         }
122         if (oldDelegate == getDelegate().getProperty()) {
123             update(getDelegate().withProperty((org.apache.maven.api.settings.ActivationProperty) newDelegate));
124             return true;
125         }
126         if (oldDelegate == getDelegate().getFile()) {
127             update(getDelegate().withFile((org.apache.maven.api.settings.ActivationFile) newDelegate));
128             return true;
129         }
130         return false;
131     }
132 
133     public static List<org.apache.maven.api.settings.Activation> activationToApiV4(List<Activation> list) {
134         return list != null ? new WrapperList<>(list, Activation::getDelegate, Activation::new) : null;
135     }
136 
137     public static List<Activation> activationToApiV3(List<org.apache.maven.api.settings.Activation> list) {
138         return list != null ? new WrapperList<>(list, Activation::new, Activation::getDelegate) : null;
139     }
140 
141 }