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