Class GradleTaskContainer

java.lang.Object
io.spring.initializr.generator.buildsystem.gradle.GradleTaskContainer

public class GradleTaskContainer extends Object
A container for Gradle tasks.
Author:
Stephane Nicoll
  • Constructor Details

    • GradleTaskContainer

      public GradleTaskContainer()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specify if this container is empty.
      Returns:
      true if no task is registered
    • has

      public boolean has(String name)
      Specify if this container has a task customization with the specified name.
      Parameters:
      name - the name of a task
      Returns:
      true if a customization for a task with the specified name exists
    • values

      public Stream<GradleTask> values()
      Return the Gradle tasks to customize.
      Returns:
      the gradle tasks
    • get

      public GradleTask get(String task)
      Get a GradleTask with the specified task name.
      Parameters:
      task - the name or type
      Returns:
      the matching gradle task or null
    • importedTypes

      public Stream<String> importedTypes()
      Return the fully qualified name of types to import.
      Returns:
      the imported types
    • customize

      public void customize(String name, Consumer<GradleTask.Builder> task)
      Customize a task with the specified name. If the task has already been customized, the consumer can be used to further tune the existing task.
      Parameters:
      name - the name of a task
      task - a callback to customize the task
    • customizeWithType

      public void customizeWithType(String type, Consumer<GradleTask.Builder> task)
      Customize a task matching a given type. If the task has already been customized, the consumer can be used to further tune the existing task.
      Parameters:
      type - the name of type. Can use the short form for well-known types such as JavaCompile, use a fully qualified name if an import is required
      task - a callback to customize the task
    • remove

      public boolean remove(String name)
      Remove the task with the specified name.
      Parameters:
      name - the name of the task
      Returns:
      true if such a task was registered, false otherwise