View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //   Generated by Maven, any modifications will be overwritten.
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   * This is an activator which will detect an operating system's attributes in order to activate
19   * its profile.
20   */
21  @Experimental
22  @Generated @ThreadSafe @Immutable
23  public class ActivationOS
24      implements Serializable
25  {
26      /**
27       * The name of the OS to be used to activate a profile.
28       */
29      final String name;
30      /**
31       * The general family of the OS to be used to activate a
32       * profile (e.g. 'windows')
33       */
34      final String family;
35      /**
36       * The architecture of the OS to be used to activate a profile.
37       */
38      final String arch;
39      /**
40       * The version of the OS to be used to activate a profile.
41       */
42      final String version;
43  
44      /**
45        * Constructor for this class, package protected.
46        * @see Builder#build()
47        */
48      ActivationOS(
49          String name,
50          String family,
51          String arch,
52          String version
53      )
54      {
55          this.name = name;
56          this.family = family;
57          this.arch = arch;
58          this.version = version;
59      }
60  
61      /**
62       * The name of the OS to be used to activate a profile.
63       *
64       * @return a {@code String}
65       */
66      public String getName()
67      {
68          return this.name;
69      }
70  
71      /**
72       * The general family of the OS to be used to activate a
73       * profile (e.g. 'windows')
74       *
75       * @return a {@code String}
76       */
77      public String getFamily()
78      {
79          return this.family;
80      }
81  
82      /**
83       * The architecture of the OS to be used to activate a profile.
84       *
85       * @return a {@code String}
86       */
87      public String getArch()
88      {
89          return this.arch;
90      }
91  
92      /**
93       * The version of the OS to be used to activate a profile.
94       *
95       * @return a {@code String}
96       */
97      public String getVersion()
98      {
99          return this.version;
100     }
101 
102     /**
103      * Creates a new builder with this object as the basis.
104      *
105      * @return a {@code Builder}
106      */
107     @Nonnull
108     public Builder with()
109     {
110         return newBuilder( this );
111     }
112     /**
113      * Creates a new {@code ActivationOS} instance using the specified name.
114      *
115      * @param name the new {@code String} to use
116      * @return a {@code ActivationOS} with the specified name
117      */
118     @Nonnull
119     public ActivationOS withName( String name )
120     {
121         return with().name( name ).build();
122     }
123     /**
124      * Creates a new {@code ActivationOS} instance using the specified family.
125      *
126      * @param family the new {@code String} to use
127      * @return a {@code ActivationOS} with the specified family
128      */
129     @Nonnull
130     public ActivationOS withFamily( String family )
131     {
132         return with().family( family ).build();
133     }
134     /**
135      * Creates a new {@code ActivationOS} instance using the specified arch.
136      *
137      * @param arch the new {@code String} to use
138      * @return a {@code ActivationOS} with the specified arch
139      */
140     @Nonnull
141     public ActivationOS withArch( String arch )
142     {
143         return with().arch( arch ).build();
144     }
145     /**
146      * Creates a new {@code ActivationOS} instance using the specified version.
147      *
148      * @param version the new {@code String} to use
149      * @return a {@code ActivationOS} with the specified version
150      */
151     @Nonnull
152     public ActivationOS withVersion( String version )
153     {
154         return with().version( version ).build();
155     }
156 
157     /**
158      * Creates a new {@code ActivationOS} instance.
159      * Equivalent to {@code newInstance( true )}.
160      * @see #newInstance(boolean)
161      *
162      * @return a new {@code ActivationOS}
163      */
164     @Nonnull
165     public static ActivationOS newInstance()
166     {
167         return newInstance( true );
168     }
169 
170     /**
171      * Creates a new {@code ActivationOS} instance using default values or not.
172      * Equivalent to {@code newBuilder( withDefaults ).build()}.
173      *
174      * @param withDefaults the boolean indicating whether default values should be used
175      * @return a new {@code ActivationOS}
176      */
177     @Nonnull
178     public static ActivationOS newInstance( boolean withDefaults )
179     {
180         return newBuilder( withDefaults ).build();
181     }
182 
183     /**
184      * Creates a new {@code ActivationOS} builder instance.
185      * Equivalent to {@code newBuilder( true )}.
186      * @see #newBuilder(boolean)
187      *
188      * @return a new {@code Builder}
189      */
190     @Nonnull
191     public static Builder newBuilder()
192     {
193         return newBuilder( true );
194     }
195 
196     /**
197      * Creates a new {@code ActivationOS} builder instance using default values or not.
198      *
199      * @param withDefaults the boolean indicating whether default values should be used
200      * @return a new {@code Builder}
201      */
202     @Nonnull
203     public static Builder newBuilder( boolean withDefaults )
204     {
205         return new Builder( withDefaults );
206     }
207 
208     /**
209      * Creates a new {@code ActivationOS} builder instance using the specified object as a basis.
210      * Equivalent to {@code newBuilder( from, false )}.
211      *
212      * @param from the {@code ActivationOS} instance to use as a basis
213      * @return a new {@code Builder}
214      */
215     @Nonnull
216     public static Builder newBuilder( ActivationOS from )
217     {
218         return newBuilder( from, false );
219     }
220 
221     /**
222      * Creates a new {@code ActivationOS} builder instance using the specified object as a basis.
223      *
224      * @param from the {@code ActivationOS} instance to use as a basis
225      * @param forceCopy the boolean indicating if a copy should be forced
226      * @return a new {@code Builder}
227      */
228     @Nonnull
229     public static Builder newBuilder( ActivationOS from, boolean forceCopy )
230     {
231         return new Builder( from, forceCopy );
232     }
233 
234     /**
235      * Builder class used to create ActivationOS instances.
236      * @see #with()
237      * @see #newBuilder()
238      */
239     @NotThreadSafe
240     public static class Builder
241     {
242         ActivationOS base;
243         String name;
244         String family;
245         String arch;
246         String version;
247 
248         Builder( boolean withDefaults )
249         {
250             if ( withDefaults )
251             {
252             }
253         }
254 
255         Builder( ActivationOS base, boolean forceCopy )
256         {
257             if ( forceCopy )
258             {
259                 this.name = base.name;
260                 this.family = base.family;
261                 this.arch = base.arch;
262                 this.version = base.version;
263             }
264             else
265             {
266                 this.base = base;
267             }
268         }
269 
270         @Nonnull
271         public Builder name( String name )
272         {
273             this.name = name;
274             return this;
275         }
276 
277         @Nonnull
278         public Builder family( String family )
279         {
280             this.family = family;
281             return this;
282         }
283 
284         @Nonnull
285         public Builder arch( String arch )
286         {
287             this.arch = arch;
288             return this;
289         }
290 
291         @Nonnull
292         public Builder version( String version )
293         {
294             this.version = version;
295             return this;
296         }
297 
298 
299         @Nonnull
300         public ActivationOS build()
301         {
302             if ( base != null
303                     && ( name == null || name == base.name )
304                     && ( family == null || family == base.family )
305                     && ( arch == null || arch == base.arch )
306                     && ( version == null || version == base.version )
307             )
308             {
309                 return base;
310             }
311             return new ActivationOS(
312                 name != null ? name : ( base != null ? base.name : null ),
313                 family != null ? family : ( base != null ? base.family : null ),
314                 arch != null ? arch : ( base != null ? base.arch : null ),
315                 version != null ? version : ( base != null ? base.version : null )
316             );
317         }
318     }
319 
320 }