1
2
3
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 if (activation != null) {
83 update(getDelegate().withActivation(activation.getDelegate()));
84 activation.childrenTracking = this::replace;
85 } else {
86 update(getDelegate().withActivation(null));
87 }
88 }
89 }
90
91 public BuildBase getBuild() {
92 return getDelegate().getBuild() != null ? new BuildBase(getDelegate().getBuild(), this) : null;
93 }
94
95 public void setBuild(BuildBase build) {
96 if (!Objects.equals(build, getBuild())){
97 if (build != null) {
98 update(getDelegate().withBuild(build.getDelegate()));
99 build.childrenTracking = this::replace;
100 } else {
101 update(getDelegate().withBuild(null));
102 }
103 }
104 }
105
106 public InputLocation getLocation(Object key) {
107 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
108 return loc != null ? new InputLocation(loc) : null;
109 }
110
111 public void setLocation(Object key, InputLocation location) {
112 update(org.apache.maven.api.model.Profile.newBuilder(getDelegate(), true)
113 .location(key, location.toApiLocation()).build());
114 }
115
116 protected boolean replace(Object oldDelegate, Object newDelegate) {
117 if (super.replace(oldDelegate, newDelegate)) {
118 return true;
119 }
120 if (oldDelegate == getDelegate().getActivation()) {
121 update(getDelegate().withActivation((org.apache.maven.api.model.Activation) newDelegate));
122 return true;
123 }
124 if (oldDelegate == getDelegate().getBuild()) {
125 update(getDelegate().withBuild((org.apache.maven.api.model.BuildBase) newDelegate));
126 return true;
127 }
128 return false;
129 }
130
131 public static List<org.apache.maven.api.model.Profile> profileToApiV4(List<Profile> list) {
132 return list != null ? new WrapperList<>(list, Profile::getDelegate, Profile::new) : null;
133 }
134
135 public static List<Profile> profileToApiV3(List<org.apache.maven.api.model.Profile> list) {
136 return list != null ? new WrapperList<>(list, Profile::new, Profile::getDelegate) : null;
137 }
138
139
140
141 public static final String SOURCE_POM = "pom";
142
143 public static final String SOURCE_SETTINGS = "settings.xml";
144
145 public void setSource( String source )
146 {
147 getDelegate().setSource( source );
148 }
149
150 public String getSource()
151 {
152 return getDelegate().getSource();
153 }
154
155
156
157
158 public String toString()
159 {
160 return "Profile {id: " + getId() + ", source: " + getSource() + "}";
161 }
162
163
164 }