1
2
3
4
5 package org.apache.maven.api.settings;
6
7 import java.io.Serializable;
8 import java.util.Collections;
9 import java.util.HashMap;
10 import java.util.Map;
11 import org.apache.maven.api.annotations.Experimental;
12 import org.apache.maven.api.annotations.Generated;
13 import org.apache.maven.api.annotations.Immutable;
14 import org.apache.maven.api.annotations.Nonnull;
15 import org.apache.maven.api.annotations.NotThreadSafe;
16 import org.apache.maven.api.annotations.ThreadSafe;
17
18
19
20
21
22
23 @Experimental
24 @Generated @ThreadSafe @Immutable
25 public class ActivationProperty
26 implements Serializable
27 {
28
29
30
31 final String name;
32
33
34
35 final String value;
36
37
38
39
40
41 ActivationProperty(
42 String name,
43 String value
44 )
45 {
46 this.name = name;
47 this.value = value;
48 }
49
50
51
52
53
54
55 public String getName()
56 {
57 return this.name;
58 }
59
60
61
62
63
64
65 public String getValue()
66 {
67 return this.value;
68 }
69
70
71
72
73
74
75 @Nonnull
76 public Builder with()
77 {
78 return newBuilder( this );
79 }
80
81
82
83
84
85
86 @Nonnull
87 public ActivationProperty withName( String name )
88 {
89 return with().name( name ).build();
90 }
91
92
93
94
95
96
97 @Nonnull
98 public ActivationProperty withValue( String value )
99 {
100 return with().value( value ).build();
101 }
102
103
104
105
106
107
108
109
110 @Nonnull
111 public static ActivationProperty newInstance()
112 {
113 return newInstance( true );
114 }
115
116
117
118
119
120
121
122
123 @Nonnull
124 public static ActivationProperty newInstance( boolean withDefaults )
125 {
126 return newBuilder( withDefaults ).build();
127 }
128
129
130
131
132
133
134
135
136 @Nonnull
137 public static Builder newBuilder()
138 {
139 return newBuilder( true );
140 }
141
142
143
144
145
146
147
148 @Nonnull
149 public static Builder newBuilder( boolean withDefaults )
150 {
151 return new Builder( withDefaults );
152 }
153
154
155
156
157
158
159
160
161 @Nonnull
162 public static Builder newBuilder( ActivationProperty from )
163 {
164 return newBuilder( from, false );
165 }
166
167
168
169
170
171
172
173
174 @Nonnull
175 public static Builder newBuilder( ActivationProperty from, boolean forceCopy )
176 {
177 return new Builder( from, forceCopy );
178 }
179
180
181
182
183
184
185 @NotThreadSafe
186 public static class Builder
187 {
188 ActivationProperty base;
189 String name;
190 String value;
191
192 Builder( boolean withDefaults )
193 {
194 if ( withDefaults )
195 {
196 }
197 }
198
199 Builder( ActivationProperty base, boolean forceCopy )
200 {
201 if ( forceCopy )
202 {
203 this.name = base.name;
204 this.value = base.value;
205 }
206 else
207 {
208 this.base = base;
209 }
210 }
211
212 @Nonnull
213 public Builder name( String name )
214 {
215 this.name = name;
216 return this;
217 }
218
219 @Nonnull
220 public Builder value( String value )
221 {
222 this.value = value;
223 return this;
224 }
225
226
227 @Nonnull
228 public ActivationProperty build()
229 {
230 if ( base != null
231 && ( name == null || name == base.name )
232 && ( value == null || value == base.value )
233 )
234 {
235 return base;
236 }
237 return new ActivationProperty(
238 name != null ? name : ( base != null ? base.name : null ),
239 value != null ? value : ( base != null ? base.value : null )
240 );
241 }
242 }
243
244 }