Interface MojoMetadataProvider.Context

  • Enclosing interface:
    MojoMetadataProvider

    public static interface MojoMetadataProvider.Context
    Allows configuring the inputs and outputs of a Mojo.
    Since:
    1.15
    • Method Detail

      • getUnderlyingObject

        java.lang.Object getUnderlyingObject()
        The object underlying the current context. The root context will return the Mojo instance, while contexts created by nested(String, Consumer) and iterate(String, Consumer) will return the nested property value.
        Since:
        1.15
      • getMojoExecution

        MojoExecution getMojoExecution()
        The goal execution being analyzed.
        Since:
        1.15
      • getProject

        MavenProject getProject()
        The project that the goal execution is part of.
        Since:
        1.15
      • getSession

        MavenSession getSession()
        The session associated with the project.
        Since:
        1.15
      • withPlugin

        void withPlugin​(java.lang.String artifactId,
                        java.lang.Runnable action)
        Executes a given action if the supplied artifactId matches Plugin.getArtifactId(). If two plugins have the same artifactId but different groupIds the action will be executed for both.
        Parameters:
        artifactId - the artifact id for which to execute the action
        action - the action to be executed
        Since:
        1.15
      • skipIfTrue

        MojoMetadataProvider.Context skipIfTrue​(java.lang.String... propertyNames)
        The goal execution will be skipped, if any of the given boolean properties is true.
        Parameters:
        propertyNames - the names of the boolean properties to be checked
        Since:
        1.15
      • skipIfTrue

        MojoMetadataProvider.Context skipIfTrue​(java.util.List<java.lang.String> propertyNames)
        The goal execution will be skipped, if any of the given boolean properties is true.
        Parameters:
        propertyNames - the names of the boolean properties to be checked
        Since:
        1.15
      • nested

        MojoMetadataProvider.Context nested​(java.lang.String propertyName,
                                            java.util.function.Consumer<? super MojoMetadataProvider.Context> action)
        Creates a nested context by looking for a property with the given name on the current context and calling the given action on it if it exists. All property names in the nested context will be prefixed with the given property name.
        Parameters:
        propertyName - the name of the property to look for on the current context
        action - the action to be executed if the supplied propertyName is found on the current context
        Since:
        1.15
      • iterate

        MojoMetadataProvider.Context iterate​(java.lang.String propertyName,
                                             java.util.function.Consumer<? super MojoMetadataProvider.Context> action)
        Creates nested contexts by looking for a property of type Iterable or Object[] with the given name in the current context and calling the given action on each item in the Iterable or Object[], if it exists. All property names in the nested contexts will be prefixed with the given property name and the index of the item in the Iterable or Object[].
        Parameters:
        propertyName - the name of the property to look for on the current context
        action - the action to be executed if the supplied propertyName is found on the current context
        Since:
        1.15