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