View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //  Generated by Modello Velocity from model.vm
3   //  template, any modifications will be overwritten.
4   // ==============================================================
5   package org.apache.maven.api.plugin.descriptor;
6   
7   import java.io.Serializable;
8   import java.util.ArrayList;
9   import java.util.Collection;
10  import java.util.Collections;
11  import java.util.HashMap;
12  import java.util.List;
13  import java.util.Map;
14  import java.util.Set;
15  import org.apache.maven.api.annotations.Experimental;
16  import org.apache.maven.api.annotations.Generated;
17  import org.apache.maven.api.annotations.Immutable;
18  import org.apache.maven.api.annotations.Nonnull;
19  import org.apache.maven.api.annotations.NotThreadSafe;
20  import org.apache.maven.api.annotations.ThreadSafe;
21  
22  /**
23   * A Mojo description.
24   */
25  @Experimental
26  @Generated @ThreadSafe @Immutable
27  public class MojoDescriptor
28      implements Serializable
29  {
30      /**
31       * The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly,
32       * or inside a POM in order to provide Mojo-specific configuration.
33       */
34      final String goal;
35      /**
36       * The description of this Mojo's functionality.
37       */
38      final String description;
39      /**
40       * The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
41       */
42      final String implementation;
43      /**
44       * The implementation language for this Mojo (java, beanshell, etc.).
45       */
46      final String language;
47      /**
48       * Defines a default phase to bind a Mojo execution to if the user does not explicitly set a phase in the POM.
49       * <p><b>Note:</b> This will not automagically make a Mojo run when the plugin declaration is added
50       * to the POM. It merely enables the user to omit the {@code <phase>} element from the
51       * surrounding {@code <execution>} element.</p>
52       */
53      final String phase;
54      /**
55       * Reference the invocation phase of the Mojo.
56       */
57      final String executePhase;
58      /**
59       * Reference the invocation goal of the Mojo.
60       */
61      final String executeGoal;
62      /**
63       * 
64       */
65      final String executeLifecycle;
66      /**
67       * Flags this Mojo as requiring the dependencies in the specified class path to be resolved before it can
68       * execute: {@code compile}, {@code runtime}, {@code test},
69       * {@code compile+runtime} (since Maven 3.0) or {@code runtime+system} (since Maven 3.0)
70       */
71      final String dependencyResolution;
72      /**
73       * Flags this Mojo as requiring information about the dependencies that would make up the specified class
74       * path. As the name suggests, this is similar to requiresDependencyResolution and supports the same values.
75       * The important difference is this will not resolve the files for the dependencies, i.e. the artifacts
76       * associated with a Maven project can lack a file. As such, this annotation is meant for Mojos that only
77       * want to analyze the set of transitive dependencies, in particular during early lifecycle phases where
78       * full dependency resolution might fail due to projects which haven't been built yet.
79       */
80      final String dependencyCollection;
81      /**
82       * Flags this Mojo to be invoked directly only.
83       */
84      final boolean directInvocationOnly;
85      /**
86       * Flags this Mojo to require running inside of a project.
87       */
88      final boolean projectRequired;
89      /**
90       * Flags this Mojo to require online mode for its operation.
91       */
92      final boolean onlineRequired;
93      /**
94       * Flags this Mojo to run it in a multi-module way, i.e. aggregate the build with the set of projects
95       * listed as modules.
96       */
97      final boolean aggregator;
98      /**
99       * Specify that the Mojo is inherited.
100      */
101     final boolean inheritedByDefault;
102     /**
103      * Specify the version when the Mojo was added to the API. Similar to Javadoc since.
104      */
105     final String since;
106     /**
107      * Description with the reason of Mojo deprecation. Similar to Javadoc {@code @deprecated}
108      * This will trigger a warning when a user tries to use a Mojo marked as deprecated.
109      */
110     final String deprecated;
111     /**
112      * The configurator type to use when injecting parameter values into this Mojo. The value is normally deduced
113      * from the Mojo's implementation language, but can be specified to allow a custom ComponentConfigurator
114      * implementation to be used.
115      */
116     final String configurator;
117     /**
118      * 
119      */
120     final List<Parameter> parameters;
121     /**
122      * 
123      */
124     final List<Resolution> resolutions;
125     /**
126      * the id of the mojo, based on the goal name
127      */
128     final String id;
129     /**
130      * the full goal name
131      */
132     final String fullGoalName;
133 
134     /**
135       * Constructor for this class, to be called from its subclasses and {@link Builder}.
136       * @see Builder#build()
137       */
138     protected MojoDescriptor(Builder builder) {
139         this.goal = builder.goal != null ? builder.goal : (builder.base != null ? builder.base.goal : null);
140         this.description = builder.description != null ? builder.description : (builder.base != null ? builder.base.description : null);
141         this.implementation = builder.implementation != null ? builder.implementation : (builder.base != null ? builder.base.implementation : null);
142         this.language = builder.language != null ? builder.language : (builder.base != null ? builder.base.language : null);
143         this.phase = builder.phase != null ? builder.phase : (builder.base != null ? builder.base.phase : null);
144         this.executePhase = builder.executePhase != null ? builder.executePhase : (builder.base != null ? builder.base.executePhase : null);
145         this.executeGoal = builder.executeGoal != null ? builder.executeGoal : (builder.base != null ? builder.base.executeGoal : null);
146         this.executeLifecycle = builder.executeLifecycle != null ? builder.executeLifecycle : (builder.base != null ? builder.base.executeLifecycle : null);
147         this.dependencyResolution = builder.dependencyResolution != null ? builder.dependencyResolution : (builder.base != null ? builder.base.dependencyResolution : null);
148         this.dependencyCollection = builder.dependencyCollection != null ? builder.dependencyCollection : (builder.base != null ? builder.base.dependencyCollection : null);
149         this.directInvocationOnly = builder.directInvocationOnly != null ? builder.directInvocationOnly : (builder.base != null ? builder.base.directInvocationOnly : false);
150         this.projectRequired = builder.projectRequired != null ? builder.projectRequired : (builder.base != null ? builder.base.projectRequired : true);
151         this.onlineRequired = builder.onlineRequired != null ? builder.onlineRequired : (builder.base != null ? builder.base.onlineRequired : false);
152         this.aggregator = builder.aggregator != null ? builder.aggregator : (builder.base != null ? builder.base.aggregator : false);
153         this.inheritedByDefault = builder.inheritedByDefault != null ? builder.inheritedByDefault : (builder.base != null ? builder.base.inheritedByDefault : true);
154         this.since = builder.since != null ? builder.since : (builder.base != null ? builder.base.since : null);
155         this.deprecated = builder.deprecated != null ? builder.deprecated : (builder.base != null ? builder.base.deprecated : null);
156         this.configurator = builder.configurator != null ? builder.configurator : (builder.base != null ? builder.base.configurator : null);
157         this.parameters = ImmutableCollections.copy(builder.parameters != null ? builder.parameters : (builder.base != null ? builder.base.parameters : null));
158         this.resolutions = ImmutableCollections.copy(builder.resolutions != null ? builder.resolutions : (builder.base != null ? builder.base.resolutions : null));
159         this.id = builder.id != null ? builder.id : (builder.base != null ? builder.base.id : null);
160         this.fullGoalName = builder.fullGoalName != null ? builder.fullGoalName : (builder.base != null ? builder.base.fullGoalName : null);
161     }
162 
163     /**
164      * The goal name for the Mojo, that users will reference from the command line to execute the Mojo directly,
165      * or inside a POM in order to provide Mojo-specific configuration.
166      *
167      * @return a {@code String}
168      */
169     public String getGoal() {
170         return this.goal;
171     }
172 
173     /**
174      * The description of this Mojo's functionality.
175      *
176      * @return a {@code String}
177      */
178     public String getDescription() {
179         return this.description;
180     }
181 
182     /**
183      * The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).
184      *
185      * @return a {@code String}
186      */
187     public String getImplementation() {
188         return this.implementation;
189     }
190 
191     /**
192      * The implementation language for this Mojo (java, beanshell, etc.).
193      *
194      * @return a {@code String}
195      */
196     public String getLanguage() {
197         return this.language;
198     }
199 
200     /**
201      * Defines a default phase to bind a Mojo execution to if the user does not explicitly set a phase in the POM.
202      * <p><b>Note:</b> This will not automagically make a Mojo run when the plugin declaration is added
203      * to the POM. It merely enables the user to omit the {@code <phase>} element from the
204      * surrounding {@code <execution>} element.</p>
205      *
206      * @return a {@code String}
207      */
208     public String getPhase() {
209         return this.phase;
210     }
211 
212     /**
213      * Reference the invocation phase of the Mojo.
214      *
215      * @return a {@code String}
216      */
217     public String getExecutePhase() {
218         return this.executePhase;
219     }
220 
221     /**
222      * Reference the invocation goal of the Mojo.
223      *
224      * @return a {@code String}
225      */
226     public String getExecuteGoal() {
227         return this.executeGoal;
228     }
229 
230     /**
231      * 
232      *
233      * @return a {@code String}
234      */
235     public String getExecuteLifecycle() {
236         return this.executeLifecycle;
237     }
238 
239     /**
240      * Flags this Mojo as requiring the dependencies in the specified class path to be resolved before it can
241      * execute: {@code compile}, {@code runtime}, {@code test},
242      * {@code compile+runtime} (since Maven 3.0) or {@code runtime+system} (since Maven 3.0)
243      *
244      * @return a {@code String}
245      */
246     public String getDependencyResolution() {
247         return this.dependencyResolution;
248     }
249 
250     /**
251      * Flags this Mojo as requiring information about the dependencies that would make up the specified class
252      * path. As the name suggests, this is similar to requiresDependencyResolution and supports the same values.
253      * The important difference is this will not resolve the files for the dependencies, i.e. the artifacts
254      * associated with a Maven project can lack a file. As such, this annotation is meant for Mojos that only
255      * want to analyze the set of transitive dependencies, in particular during early lifecycle phases where
256      * full dependency resolution might fail due to projects which haven't been built yet.
257      *
258      * @return a {@code String}
259      */
260     public String getDependencyCollection() {
261         return this.dependencyCollection;
262     }
263 
264     /**
265      * Flags this Mojo to be invoked directly only.
266      *
267      * @return a {@code boolean}
268      */
269     public boolean isDirectInvocationOnly() {
270         return this.directInvocationOnly;
271     }
272 
273     /**
274      * Flags this Mojo to require running inside of a project.
275      *
276      * @return a {@code boolean}
277      */
278     public boolean isProjectRequired() {
279         return this.projectRequired;
280     }
281 
282     /**
283      * Flags this Mojo to require online mode for its operation.
284      *
285      * @return a {@code boolean}
286      */
287     public boolean isOnlineRequired() {
288         return this.onlineRequired;
289     }
290 
291     /**
292      * Flags this Mojo to run it in a multi-module way, i.e. aggregate the build with the set of projects
293      * listed as modules.
294      *
295      * @return a {@code boolean}
296      */
297     public boolean isAggregator() {
298         return this.aggregator;
299     }
300 
301     /**
302      * Specify that the Mojo is inherited.
303      *
304      * @return a {@code boolean}
305      */
306     public boolean isInheritedByDefault() {
307         return this.inheritedByDefault;
308     }
309 
310     /**
311      * Specify the version when the Mojo was added to the API. Similar to Javadoc since.
312      *
313      * @return a {@code String}
314      */
315     public String getSince() {
316         return this.since;
317     }
318 
319     /**
320      * Description with the reason of Mojo deprecation. Similar to Javadoc {@code @deprecated}
321      * This will trigger a warning when a user tries to use a Mojo marked as deprecated.
322      *
323      * @return a {@code String}
324      */
325     public String getDeprecated() {
326         return this.deprecated;
327     }
328 
329     /**
330      * The configurator type to use when injecting parameter values into this Mojo. The value is normally deduced
331      * from the Mojo's implementation language, but can be specified to allow a custom ComponentConfigurator
332      * implementation to be used.
333      *
334      * @return a {@code String}
335      */
336     public String getConfigurator() {
337         return this.configurator;
338     }
339 
340     /**
341      * 
342      *
343      * @return a {@code List<Parameter>}
344      */
345     @Nonnull
346     public List<Parameter> getParameters() {
347         return this.parameters;
348     }
349 
350     /**
351      * 
352      *
353      * @return a {@code List<Resolution>}
354      */
355     @Nonnull
356     public List<Resolution> getResolutions() {
357         return this.resolutions;
358     }
359 
360     /**
361      * the id of the mojo, based on the goal name
362      *
363      * @return a {@code String}
364      */
365     public String getId() {
366         return this.id;
367     }
368 
369     /**
370      * the full goal name
371      *
372      * @return a {@code String}
373      */
374     public String getFullGoalName() {
375         return this.fullGoalName;
376     }
377 
378     /**
379      * Creates a new builder with this object as the basis.
380      *
381      * @return a {@code Builder}
382      */
383     @Nonnull
384     public Builder with() {
385         return newBuilder(this);
386     }
387     /**
388      * Creates a new {@code MojoDescriptor} instance using the specified goal.
389      *
390      * @param goal the new {@code String} to use
391      * @return a {@code MojoDescriptor} with the specified goal
392      */
393     @Nonnull
394     public MojoDescriptor withGoal(String goal) {
395         return newBuilder(this, true).goal(goal).build();
396     }
397     /**
398      * Creates a new {@code MojoDescriptor} instance using the specified description.
399      *
400      * @param description the new {@code String} to use
401      * @return a {@code MojoDescriptor} with the specified description
402      */
403     @Nonnull
404     public MojoDescriptor withDescription(String description) {
405         return newBuilder(this, true).description(description).build();
406     }
407     /**
408      * Creates a new {@code MojoDescriptor} instance using the specified implementation.
409      *
410      * @param implementation the new {@code String} to use
411      * @return a {@code MojoDescriptor} with the specified implementation
412      */
413     @Nonnull
414     public MojoDescriptor withImplementation(String implementation) {
415         return newBuilder(this, true).implementation(implementation).build();
416     }
417     /**
418      * Creates a new {@code MojoDescriptor} instance using the specified language.
419      *
420      * @param language the new {@code String} to use
421      * @return a {@code MojoDescriptor} with the specified language
422      */
423     @Nonnull
424     public MojoDescriptor withLanguage(String language) {
425         return newBuilder(this, true).language(language).build();
426     }
427     /**
428      * Creates a new {@code MojoDescriptor} instance using the specified phase.
429      *
430      * @param phase the new {@code String} to use
431      * @return a {@code MojoDescriptor} with the specified phase
432      */
433     @Nonnull
434     public MojoDescriptor withPhase(String phase) {
435         return newBuilder(this, true).phase(phase).build();
436     }
437     /**
438      * Creates a new {@code MojoDescriptor} instance using the specified executePhase.
439      *
440      * @param executePhase the new {@code String} to use
441      * @return a {@code MojoDescriptor} with the specified executePhase
442      */
443     @Nonnull
444     public MojoDescriptor withExecutePhase(String executePhase) {
445         return newBuilder(this, true).executePhase(executePhase).build();
446     }
447     /**
448      * Creates a new {@code MojoDescriptor} instance using the specified executeGoal.
449      *
450      * @param executeGoal the new {@code String} to use
451      * @return a {@code MojoDescriptor} with the specified executeGoal
452      */
453     @Nonnull
454     public MojoDescriptor withExecuteGoal(String executeGoal) {
455         return newBuilder(this, true).executeGoal(executeGoal).build();
456     }
457     /**
458      * Creates a new {@code MojoDescriptor} instance using the specified executeLifecycle.
459      *
460      * @param executeLifecycle the new {@code String} to use
461      * @return a {@code MojoDescriptor} with the specified executeLifecycle
462      */
463     @Nonnull
464     public MojoDescriptor withExecuteLifecycle(String executeLifecycle) {
465         return newBuilder(this, true).executeLifecycle(executeLifecycle).build();
466     }
467     /**
468      * Creates a new {@code MojoDescriptor} instance using the specified dependencyResolution.
469      *
470      * @param dependencyResolution the new {@code String} to use
471      * @return a {@code MojoDescriptor} with the specified dependencyResolution
472      */
473     @Nonnull
474     public MojoDescriptor withDependencyResolution(String dependencyResolution) {
475         return newBuilder(this, true).dependencyResolution(dependencyResolution).build();
476     }
477     /**
478      * Creates a new {@code MojoDescriptor} instance using the specified dependencyCollection.
479      *
480      * @param dependencyCollection the new {@code String} to use
481      * @return a {@code MojoDescriptor} with the specified dependencyCollection
482      */
483     @Nonnull
484     public MojoDescriptor withDependencyCollection(String dependencyCollection) {
485         return newBuilder(this, true).dependencyCollection(dependencyCollection).build();
486     }
487     /**
488      * Creates a new {@code MojoDescriptor} instance using the specified directInvocationOnly.
489      *
490      * @param directInvocationOnly the new {@code boolean} to use
491      * @return a {@code MojoDescriptor} with the specified directInvocationOnly
492      */
493     @Nonnull
494     public MojoDescriptor withDirectInvocationOnly(boolean directInvocationOnly) {
495         return newBuilder(this, true).directInvocationOnly(directInvocationOnly).build();
496     }
497     /**
498      * Creates a new {@code MojoDescriptor} instance using the specified projectRequired.
499      *
500      * @param projectRequired the new {@code boolean} to use
501      * @return a {@code MojoDescriptor} with the specified projectRequired
502      */
503     @Nonnull
504     public MojoDescriptor withProjectRequired(boolean projectRequired) {
505         return newBuilder(this, true).projectRequired(projectRequired).build();
506     }
507     /**
508      * Creates a new {@code MojoDescriptor} instance using the specified onlineRequired.
509      *
510      * @param onlineRequired the new {@code boolean} to use
511      * @return a {@code MojoDescriptor} with the specified onlineRequired
512      */
513     @Nonnull
514     public MojoDescriptor withOnlineRequired(boolean onlineRequired) {
515         return newBuilder(this, true).onlineRequired(onlineRequired).build();
516     }
517     /**
518      * Creates a new {@code MojoDescriptor} instance using the specified aggregator.
519      *
520      * @param aggregator the new {@code boolean} to use
521      * @return a {@code MojoDescriptor} with the specified aggregator
522      */
523     @Nonnull
524     public MojoDescriptor withAggregator(boolean aggregator) {
525         return newBuilder(this, true).aggregator(aggregator).build();
526     }
527     /**
528      * Creates a new {@code MojoDescriptor} instance using the specified inheritedByDefault.
529      *
530      * @param inheritedByDefault the new {@code boolean} to use
531      * @return a {@code MojoDescriptor} with the specified inheritedByDefault
532      */
533     @Nonnull
534     public MojoDescriptor withInheritedByDefault(boolean inheritedByDefault) {
535         return newBuilder(this, true).inheritedByDefault(inheritedByDefault).build();
536     }
537     /**
538      * Creates a new {@code MojoDescriptor} instance using the specified since.
539      *
540      * @param since the new {@code String} to use
541      * @return a {@code MojoDescriptor} with the specified since
542      */
543     @Nonnull
544     public MojoDescriptor withSince(String since) {
545         return newBuilder(this, true).since(since).build();
546     }
547     /**
548      * Creates a new {@code MojoDescriptor} instance using the specified deprecated.
549      *
550      * @param deprecated the new {@code String} to use
551      * @return a {@code MojoDescriptor} with the specified deprecated
552      */
553     @Nonnull
554     public MojoDescriptor withDeprecated(String deprecated) {
555         return newBuilder(this, true).deprecated(deprecated).build();
556     }
557     /**
558      * Creates a new {@code MojoDescriptor} instance using the specified configurator.
559      *
560      * @param configurator the new {@code String} to use
561      * @return a {@code MojoDescriptor} with the specified configurator
562      */
563     @Nonnull
564     public MojoDescriptor withConfigurator(String configurator) {
565         return newBuilder(this, true).configurator(configurator).build();
566     }
567     /**
568      * Creates a new {@code MojoDescriptor} instance using the specified parameters.
569      *
570      * @param parameters the new {@code Collection<Parameter>} to use
571      * @return a {@code MojoDescriptor} with the specified parameters
572      */
573     @Nonnull
574     public MojoDescriptor withParameters(Collection<Parameter> parameters) {
575         return newBuilder(this, true).parameters(parameters).build();
576     }
577     /**
578      * Creates a new {@code MojoDescriptor} instance using the specified resolutions.
579      *
580      * @param resolutions the new {@code Collection<Resolution>} to use
581      * @return a {@code MojoDescriptor} with the specified resolutions
582      */
583     @Nonnull
584     public MojoDescriptor withResolutions(Collection<Resolution> resolutions) {
585         return newBuilder(this, true).resolutions(resolutions).build();
586     }
587     /**
588      * Creates a new {@code MojoDescriptor} instance using the specified id.
589      *
590      * @param id the new {@code String} to use
591      * @return a {@code MojoDescriptor} with the specified id
592      */
593     @Nonnull
594     public MojoDescriptor withId(String id) {
595         return newBuilder(this, true).id(id).build();
596     }
597     /**
598      * Creates a new {@code MojoDescriptor} instance using the specified fullGoalName.
599      *
600      * @param fullGoalName the new {@code String} to use
601      * @return a {@code MojoDescriptor} with the specified fullGoalName
602      */
603     @Nonnull
604     public MojoDescriptor withFullGoalName(String fullGoalName) {
605         return newBuilder(this, true).fullGoalName(fullGoalName).build();
606     }
607 
608     /**
609      * Creates a new {@code MojoDescriptor} instance.
610      * Equivalent to {@code newInstance(true)}.
611      * @see #newInstance(boolean)
612      *
613      * @return a new {@code MojoDescriptor}
614      */
615     @Nonnull
616     public static MojoDescriptor newInstance() {
617         return newInstance(true);
618     }
619 
620     /**
621      * Creates a new {@code MojoDescriptor} instance using default values or not.
622      * Equivalent to {@code newBuilder(withDefaults).build()}.
623      *
624      * @param withDefaults the boolean indicating whether default values should be used
625      * @return a new {@code MojoDescriptor}
626      */
627     @Nonnull
628     public static MojoDescriptor newInstance(boolean withDefaults) {
629         return newBuilder(withDefaults).build();
630     }
631 
632     /**
633      * Creates a new {@code MojoDescriptor} builder instance.
634      * Equivalent to {@code newBuilder(true)}.
635      * @see #newBuilder(boolean)
636      *
637      * @return a new {@code Builder}
638      */
639     @Nonnull
640     public static Builder newBuilder() {
641         return newBuilder(true);
642     }
643 
644     /**
645      * Creates a new {@code MojoDescriptor} builder instance using default values or not.
646      *
647      * @param withDefaults the boolean indicating whether default values should be used
648      * @return a new {@code Builder}
649      */
650     @Nonnull
651     public static Builder newBuilder(boolean withDefaults) {
652         return new Builder(withDefaults);
653     }
654 
655     /**
656      * Creates a new {@code MojoDescriptor} builder instance using the specified object as a basis.
657      * Equivalent to {@code newBuilder(from, false)}.
658      *
659      * @param from the {@code MojoDescriptor} instance to use as a basis
660      * @return a new {@code Builder}
661      */
662     @Nonnull
663     public static Builder newBuilder(MojoDescriptor from) {
664         return newBuilder(from, false);
665     }
666 
667     /**
668      * Creates a new {@code MojoDescriptor} builder instance using the specified object as a basis.
669      *
670      * @param from the {@code MojoDescriptor} instance to use as a basis
671      * @param forceCopy the boolean indicating if a copy should be forced
672      * @return a new {@code Builder}
673      */
674     @Nonnull
675     public static Builder newBuilder(MojoDescriptor from, boolean forceCopy) {
676         return new Builder(from, forceCopy);
677     }
678 
679     /**
680      * Builder class used to create MojoDescriptor instances.
681      * @see #with()
682      * @see #newBuilder()
683      */
684     @NotThreadSafe
685     public static class Builder
686     {
687         MojoDescriptor base;
688         String goal;
689         String description;
690         String implementation;
691         String language;
692         String phase;
693         String executePhase;
694         String executeGoal;
695         String executeLifecycle;
696         String dependencyResolution;
697         String dependencyCollection;
698         Boolean directInvocationOnly;
699         Boolean projectRequired;
700         Boolean onlineRequired;
701         Boolean aggregator;
702         Boolean inheritedByDefault;
703         String since;
704         String deprecated;
705         String configurator;
706         Collection<Parameter> parameters;
707         Collection<Resolution> resolutions;
708         String id;
709         String fullGoalName;
710 
711         protected Builder(boolean withDefaults) {
712             if (withDefaults) {
713                 this.language = "java";
714                 this.dependencyResolution = "runtime";
715                 this.directInvocationOnly = false;
716                 this.projectRequired = true;
717                 this.onlineRequired = false;
718                 this.aggregator = false;
719                 this.inheritedByDefault = true;
720             }
721         }
722 
723         protected Builder(MojoDescriptor base, boolean forceCopy) {
724             if (forceCopy) {
725                 this.goal = base.goal;
726                 this.description = base.description;
727                 this.implementation = base.implementation;
728                 this.language = base.language;
729                 this.phase = base.phase;
730                 this.executePhase = base.executePhase;
731                 this.executeGoal = base.executeGoal;
732                 this.executeLifecycle = base.executeLifecycle;
733                 this.dependencyResolution = base.dependencyResolution;
734                 this.dependencyCollection = base.dependencyCollection;
735                 this.directInvocationOnly = base.directInvocationOnly;
736                 this.projectRequired = base.projectRequired;
737                 this.onlineRequired = base.onlineRequired;
738                 this.aggregator = base.aggregator;
739                 this.inheritedByDefault = base.inheritedByDefault;
740                 this.since = base.since;
741                 this.deprecated = base.deprecated;
742                 this.configurator = base.configurator;
743                 this.parameters = base.parameters;
744                 this.resolutions = base.resolutions;
745                 this.id = base.id;
746                 this.fullGoalName = base.fullGoalName;
747             } else {
748                 this.base = base;
749             }
750         }
751 
752         @Nonnull
753         public Builder goal(String goal) {
754             this.goal = goal;
755             return this;
756         }
757 
758         @Nonnull
759         public Builder description(String description) {
760             this.description = description;
761             return this;
762         }
763 
764         @Nonnull
765         public Builder implementation(String implementation) {
766             this.implementation = implementation;
767             return this;
768         }
769 
770         @Nonnull
771         public Builder language(String language) {
772             this.language = language;
773             return this;
774         }
775 
776         @Nonnull
777         public Builder phase(String phase) {
778             this.phase = phase;
779             return this;
780         }
781 
782         @Nonnull
783         public Builder executePhase(String executePhase) {
784             this.executePhase = executePhase;
785             return this;
786         }
787 
788         @Nonnull
789         public Builder executeGoal(String executeGoal) {
790             this.executeGoal = executeGoal;
791             return this;
792         }
793 
794         @Nonnull
795         public Builder executeLifecycle(String executeLifecycle) {
796             this.executeLifecycle = executeLifecycle;
797             return this;
798         }
799 
800         @Nonnull
801         public Builder dependencyResolution(String dependencyResolution) {
802             this.dependencyResolution = dependencyResolution;
803             return this;
804         }
805 
806         @Nonnull
807         public Builder dependencyCollection(String dependencyCollection) {
808             this.dependencyCollection = dependencyCollection;
809             return this;
810         }
811 
812         @Nonnull
813         public Builder directInvocationOnly(boolean directInvocationOnly) {
814             this.directInvocationOnly = directInvocationOnly;
815             return this;
816         }
817 
818         @Nonnull
819         public Builder projectRequired(boolean projectRequired) {
820             this.projectRequired = projectRequired;
821             return this;
822         }
823 
824         @Nonnull
825         public Builder onlineRequired(boolean onlineRequired) {
826             this.onlineRequired = onlineRequired;
827             return this;
828         }
829 
830         @Nonnull
831         public Builder aggregator(boolean aggregator) {
832             this.aggregator = aggregator;
833             return this;
834         }
835 
836         @Nonnull
837         public Builder inheritedByDefault(boolean inheritedByDefault) {
838             this.inheritedByDefault = inheritedByDefault;
839             return this;
840         }
841 
842         @Nonnull
843         public Builder since(String since) {
844             this.since = since;
845             return this;
846         }
847 
848         @Nonnull
849         public Builder deprecated(String deprecated) {
850             this.deprecated = deprecated;
851             return this;
852         }
853 
854         @Nonnull
855         public Builder configurator(String configurator) {
856             this.configurator = configurator;
857             return this;
858         }
859 
860         @Nonnull
861         public Builder parameters(Collection<Parameter> parameters) {
862             this.parameters = parameters;
863             return this;
864         }
865 
866         @Nonnull
867         public Builder resolutions(Collection<Resolution> resolutions) {
868             this.resolutions = resolutions;
869             return this;
870         }
871 
872         @Nonnull
873         public Builder id(String id) {
874             this.id = id;
875             return this;
876         }
877 
878         @Nonnull
879         public Builder fullGoalName(String fullGoalName) {
880             this.fullGoalName = fullGoalName;
881             return this;
882         }
883 
884 
885         @Nonnull
886         public MojoDescriptor build() {
887             // this method should not contain any logic other than creating (or reusing) an object in order to ease subclassing
888             if (base != null
889                     && (goal == null || goal == base.goal)
890                     && (description == null || description == base.description)
891                     && (implementation == null || implementation == base.implementation)
892                     && (language == null || language == base.language)
893                     && (phase == null || phase == base.phase)
894                     && (executePhase == null || executePhase == base.executePhase)
895                     && (executeGoal == null || executeGoal == base.executeGoal)
896                     && (executeLifecycle == null || executeLifecycle == base.executeLifecycle)
897                     && (dependencyResolution == null || dependencyResolution == base.dependencyResolution)
898                     && (dependencyCollection == null || dependencyCollection == base.dependencyCollection)
899                     && (directInvocationOnly == null || directInvocationOnly == base.directInvocationOnly)
900                     && (projectRequired == null || projectRequired == base.projectRequired)
901                     && (onlineRequired == null || onlineRequired == base.onlineRequired)
902                     && (aggregator == null || aggregator == base.aggregator)
903                     && (inheritedByDefault == null || inheritedByDefault == base.inheritedByDefault)
904                     && (since == null || since == base.since)
905                     && (deprecated == null || deprecated == base.deprecated)
906                     && (configurator == null || configurator == base.configurator)
907                     && (parameters == null || parameters == base.parameters)
908                     && (resolutions == null || resolutions == base.resolutions)
909                     && (id == null || id == base.id)
910                     && (fullGoalName == null || fullGoalName == base.fullGoalName)
911             ) {
912                 return base;
913             }
914             return new MojoDescriptor(this);
915         }
916     }
917 
918 }