Class Parameter

java.lang.Object
org.apache.maven.api.plugin.descriptor.Parameter
All Implemented Interfaces:
Serializable

@Experimental @Generated @ThreadSafe @Immutable public class Parameter extends Object implements Serializable
A phase mapping definition.
See Also:
  • Method Details

    • getName

      public String getName()
      The name of the parameter, to be used while configuring this parameter from the Mojo's declared defaults or from the POM.
      Returns:
      a String
    • getAlias

      public String getAlias()
      Specifies an alias which can be used to configure this parameter from the POM. This is primarily useful to improve user-friendliness, where Mojo field names are not intuitive to the user or are otherwise not conducive to configuration via the POM.
      Returns:
      a String
    • getType

      public String getType()
      The Java type for this parameter. This is used to validate the result of any expressions used to calculate the value which should be injected into the Mojo for this parameter.
      Returns:
      a String
    • isRequired

      public boolean isRequired()
      Whether this parameter is required for the Mojo to function. This is used to validate the configuration for a Mojo before it is injected, and before the Mojo is executed from some half-state.
      Returns:
      a boolean
    • isEditable

      public boolean isEditable()
      Specifies that this parameter can be configured directly by the user (as in the case of POM-specified configuration). This is useful when you want to force the user to use common POM elements rather than plugin configurations, as in the case where you want to use the artifact's final name as a parameter. In this case, you want the user to modify <build><finalName/></build> rather than specifying a value for finalName directly in the plugin configuration section. It is also useful to ensure that - for example - a List-typed parameter which expects items of type Artifact doesn't get a List full of Strings.
      Returns:
      a boolean
    • getDescription

      public String getDescription()
      The description of this parameter's use inside the Mojo.
      Returns:
      a String
    • getSince

      public String getSince()
      Specify the version when the parameter was added to the API. Similar to Javadoc since.
      Returns:
      a String
    • getDeprecated

      public String getDeprecated()
      Description with the reason of parameter deprecation. Similar to Javadoc @deprecated. This will trigger a warning when a user tries to configure a parameter marked as deprecated.
      Returns:
      a String
    • getExpression

      public String getExpression()
      Parameter expression, to let user override default value with a user property, system property or project property.
      Returns:
      a String
    • getDefaultValue

      public String getDefaultValue()
      The default value, as an expression that will be evaluated at injection or run-time.
      Returns:
      a String
    • with

      @Nonnull public Parameter.Builder with()
      Creates a new builder with this object as the basis.
      Returns:
      a Builder
    • withName

      @Nonnull public Parameter withName(String name)
      Creates a new Parameter instance using the specified name.
      Parameters:
      name - the new String to use
      Returns:
      a Parameter with the specified name
    • withAlias

      @Nonnull public Parameter withAlias(String alias)
      Creates a new Parameter instance using the specified alias.
      Parameters:
      alias - the new String to use
      Returns:
      a Parameter with the specified alias
    • withType

      @Nonnull public Parameter withType(String type)
      Creates a new Parameter instance using the specified type.
      Parameters:
      type - the new String to use
      Returns:
      a Parameter with the specified type
    • withRequired

      @Nonnull public Parameter withRequired(boolean required)
      Creates a new Parameter instance using the specified required.
      Parameters:
      required - the new boolean to use
      Returns:
      a Parameter with the specified required
    • withEditable

      @Nonnull public Parameter withEditable(boolean editable)
      Creates a new Parameter instance using the specified editable.
      Parameters:
      editable - the new boolean to use
      Returns:
      a Parameter with the specified editable
    • withDescription

      @Nonnull public Parameter withDescription(String description)
      Creates a new Parameter instance using the specified description.
      Parameters:
      description - the new String to use
      Returns:
      a Parameter with the specified description
    • withSince

      @Nonnull public Parameter withSince(String since)
      Creates a new Parameter instance using the specified since.
      Parameters:
      since - the new String to use
      Returns:
      a Parameter with the specified since
    • withDeprecated

      @Nonnull public Parameter withDeprecated(String deprecated)
      Creates a new Parameter instance using the specified deprecated.
      Parameters:
      deprecated - the new String to use
      Returns:
      a Parameter with the specified deprecated
    • withExpression

      @Nonnull public Parameter withExpression(String expression)
      Creates a new Parameter instance using the specified expression.
      Parameters:
      expression - the new String to use
      Returns:
      a Parameter with the specified expression
    • withDefaultValue

      @Nonnull public Parameter withDefaultValue(String defaultValue)
      Creates a new Parameter instance using the specified defaultValue.
      Parameters:
      defaultValue - the new String to use
      Returns:
      a Parameter with the specified defaultValue
    • newInstance

      @Nonnull public static Parameter newInstance()
      Creates a new Parameter instance. Equivalent to newInstance(true).
      Returns:
      a new Parameter
      See Also:
    • newInstance

      @Nonnull public static Parameter newInstance(boolean withDefaults)
      Creates a new Parameter instance using default values or not. Equivalent to newBuilder(withDefaults).build().
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Parameter
    • newBuilder

      @Nonnull public static Parameter.Builder newBuilder()
      Creates a new Parameter builder instance. Equivalent to newBuilder(true).
      Returns:
      a new Builder
      See Also:
    • newBuilder

      @Nonnull public static Parameter.Builder newBuilder(boolean withDefaults)
      Creates a new Parameter builder instance using default values or not.
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static Parameter.Builder newBuilder(Parameter from)
      Creates a new Parameter builder instance using the specified object as a basis. Equivalent to newBuilder(from, false).
      Parameters:
      from - the Parameter instance to use as a basis
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static Parameter.Builder newBuilder(Parameter from, boolean forceCopy)
      Creates a new Parameter builder instance using the specified object as a basis.
      Parameters:
      from - the Parameter instance to use as a basis
      forceCopy - the boolean indicating if a copy should be forced
      Returns:
      a new Builder