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.ArrayList;
10  import java.util.Collections;
11  import java.util.HashMap;
12  import java.util.List;
13  import java.util.Map;
14  import java.util.Objects;
15  import java.util.Properties;
16  import java.util.Set;
17  import java.util.stream.Collectors;
18  import java.util.stream.Stream;
19  import org.apache.maven.api.annotations.Generated;
20  import org.apache.maven.api.annotations.Nonnull;
21  import org.codehaus.plexus.util.xml.Xpp3Dom;
22  
23  @Generated
24  public class Profile
25      extends ModelBase
26      implements Serializable, Cloneable
27  {
28  
29      public Profile() {
30          this(org.apache.maven.api.model.Profile.newInstance());
31      }
32  
33      public Profile(org.apache.maven.api.model.Profile delegate) {
34          this(delegate, null);
35      }
36  
37      public Profile(org.apache.maven.api.model.Profile delegate, BaseObject parent) {
38          super(delegate, parent);
39      }
40  
41      public Profile clone(){
42          return new Profile(getDelegate());
43      }
44  
45      @Override
46      public org.apache.maven.api.model.Profile getDelegate() {
47          return (org.apache.maven.api.model.Profile) super.getDelegate();
48      }
49  
50      @Override
51      public boolean equals(Object o) {
52          if (this == o) {
53              return true;
54          }
55          if (o == null || !(o instanceof Profile)) {
56              return false;
57          }
58          Profile that = (Profile) o;
59          return Objects.equals(this.delegate, that.delegate);
60      }
61  
62      @Override
63      public int hashCode() {
64          return getDelegate().hashCode();
65      }
66  
67      public String getId() {
68          return getDelegate().getId();
69      }
70  
71      public void setId(String id) {
72          if (!Objects.equals(id, getId())) {
73              update(getDelegate().withId(id));
74          }
75      }
76  
77      public Activation getActivation() {
78          return getDelegate().getActivation() != null ? new Activation(getDelegate().getActivation(), this) : null;
79      }
80  
81      public void setActivation(Activation activation) {
82          if (!Objects.equals(activation, getActivation())){
83              if (activation != null) {
84                  update(getDelegate().withActivation(activation.getDelegate()));
85                  activation.childrenTracking = this::replace;
86              } else {
87                  update(getDelegate().withActivation(null));
88              }
89          }
90      }
91  
92      public BuildBase getBuild() {
93          return getDelegate().getBuild() != null ? new BuildBase(getDelegate().getBuild(), this) : null;
94      }
95  
96      public void setBuild(BuildBase build) {
97          if (!Objects.equals(build, getBuild())){
98              if (build != null) {
99                  update(getDelegate().withBuild(build.getDelegate()));
100                 build.childrenTracking = this::replace;
101             } else {
102                 update(getDelegate().withBuild(null));
103             }
104         }
105     }
106 
107     public InputLocation getLocation(Object key) {
108         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
109         return loc != null ? new InputLocation(loc) : null;
110     }
111 
112     public void setLocation(Object key, InputLocation location) {
113         update(org.apache.maven.api.model.Profile.newBuilder(getDelegate(), true)
114                         .location(key, location.toApiLocation()).build());
115     }
116 
117     public InputLocation getImportedFrom() {
118         org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
119         return loc != null ? new InputLocation(loc) : null;
120     }
121 
122     public void setImportedFrom(InputLocation location) {
123         update(org.apache.maven.api.model.Profile.newBuilder(getDelegate(), true)
124                         .importedFrom(location.toApiLocation()).build());
125     }
126 
127     public Set<Object> getLocationKeys() {
128         return getDelegate().getLocationKeys();
129     }
130 
131     protected boolean replace(Object oldDelegate, Object newDelegate) {
132         if (super.replace(oldDelegate, newDelegate)) {
133             return true;
134         }
135         if (oldDelegate == getDelegate().getActivation()) {
136             update(getDelegate().withActivation((org.apache.maven.api.model.Activation) newDelegate));
137             return true;
138         }
139         if (oldDelegate == getDelegate().getBuild()) {
140             update(getDelegate().withBuild((org.apache.maven.api.model.BuildBase) newDelegate));
141             return true;
142         }
143         return false;
144     }
145 
146     public static List<org.apache.maven.api.model.Profile> profileToApiV4(List<Profile> list) {
147         return list != null ? new WrapperList<>(list, Profile::getDelegate, Profile::new) : null;
148     }
149 
150     public static List<Profile> profileToApiV3(List<org.apache.maven.api.model.Profile> list) {
151         return list != null ? new WrapperList<>(list, Profile::new, Profile::getDelegate) : null;
152     }
153 
154 
155             
156     public static final String SOURCE_POM = "pom";
157 
158     public static final String SOURCE_SETTINGS = "settings.xml";
159 
160     public void setSource(String source) {
161         getDelegate().setSource(source);
162     }
163 
164     public String getSource() {
165         return getDelegate().getSource();
166     }
167 
168     /**
169      * @see java.lang.Object#toString()
170      */
171     public String toString() {
172         return "Profile {id: " + getId() + ", source: " + getSource() + "}";
173     }
174             
175           
176 }