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