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.model;
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.model.Activation.newInstance());
27      }
28  
29      public Activation(org.apache.maven.api.model.Activation delegate) {
30          this(delegate, null);
31      }
32  
33      public Activation(org.apache.maven.api.model.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.model.Activation getDelegate() {
42          return (org.apache.maven.api.model.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 InputLocation getLocation(Object key) {
128         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
129         return loc != null ? new InputLocation(loc) : null;
130     }
131 
132     public void setLocation(Object key, InputLocation location) {
133         update(org.apache.maven.api.model.Activation.newBuilder(getDelegate(), true)
134                         .location(key, location.toApiLocation()).build());
135     }
136 
137     public InputLocation getImportedFrom() {
138         org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
139         return loc != null ? new InputLocation(loc) : null;
140     }
141 
142     public void setImportedFrom(InputLocation location) {
143         update(org.apache.maven.api.model.Activation.newBuilder(getDelegate(), true)
144                         .importedFrom(location.toApiLocation()).build());
145     }
146 
147     public Set<Object> getLocationKeys() {
148         return getDelegate().getLocationKeys();
149     }
150 
151     protected boolean replace(Object oldDelegate, Object newDelegate) {
152         if (super.replace(oldDelegate, newDelegate)) {
153             return true;
154         }
155         if (oldDelegate == getDelegate().getOs()) {
156             update(getDelegate().withOs((org.apache.maven.api.model.ActivationOS) newDelegate));
157             return true;
158         }
159         if (oldDelegate == getDelegate().getProperty()) {
160             update(getDelegate().withProperty((org.apache.maven.api.model.ActivationProperty) newDelegate));
161             return true;
162         }
163         if (oldDelegate == getDelegate().getFile()) {
164             update(getDelegate().withFile((org.apache.maven.api.model.ActivationFile) newDelegate));
165             return true;
166         }
167         return false;
168     }
169 
170     public static List<org.apache.maven.api.model.Activation> activationToApiV4(List<Activation> list) {
171         return list != null ? new WrapperList<>(list, Activation::getDelegate, Activation::new) : null;
172     }
173 
174     public static List<Activation> activationToApiV3(List<org.apache.maven.api.model.Activation> list) {
175         return list != null ? new WrapperList<>(list, Activation::new, Activation::getDelegate) : null;
176     }
177 
178 }