Class MavenExtensionContainer

java.lang.Object
io.spring.initializr.generator.buildsystem.maven.MavenExtensionContainer

public class MavenExtensionContainer extends Object
A container for maven extensions.
Author:
Niklas Herder, Stephane Nicoll
  • Constructor Details

    • MavenExtensionContainer

      public MavenExtensionContainer()
  • Method Details

    • isEmpty

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

      public boolean has(String groupId, String artifactId)
      Specify if this container has a extension with the specified groupId and artifactId.
      Parameters:
      groupId - the groupId of the extension
      artifactId - the artifactId of the extension
      Returns:
      true if an item with the specified groupId and artifactId exists
    • values

      public Stream<MavenExtension> values()
      Returns a Stream of registered MavenExtensions.
      Returns:
      a stream of MavenExtensions
    • add

      public void add(String groupId, String artifactId, String version)
      Add a MavenExtension with the specified groupId, artifactId, and version. If the extension has already been added, only update the version if necessary.
      Parameters:
      groupId - the groupId of the extension
      artifactId - the artifactId of the extension
      version - the version of the extension
      See Also:
    • add

      public void add(String groupId, String artifactId, Consumer<MavenExtension.Builder> extension)
      Add a MavenExtension with the specified groupId and artifactId and Consumer to customize the extension. If the extension has already been added, the consumer can be used to further tune the existing extension configuration.
      Parameters:
      groupId - the groupId of the extension
      artifactId - the artifactId of the extension
      extension - a Consumer to customize the MavenExtension
    • remove

      public boolean remove(String groupId, String artifactId)
      Remove the extension with the specified groupId and artifactId.
      Parameters:
      groupId - the groupId of the extension to remove
      artifactId - the artifactId of the extension to remove
      Returns:
      true if such a extension was registered, false otherwise