Class ImmutableMavenDependency.Builder

java.lang.Object
io.github.ascopes.protobufmavenplugin.dependencies.ImmutableMavenDependency.Builder
Enclosing class:
ImmutableMavenDependency

public static final class ImmutableMavenDependency.Builder extends Object
Builds instances of type ImmutableMavenDependency. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      Fill a builder with attribute values from the provided MavenDependencyBean instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      public final ImmutableMavenDependency.Builder from(MavenArtifact instance)
      Fill a builder with attribute values from the provided io.github.ascopes.protobufmavenplugin.dependencies.MavenArtifact instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      public final ImmutableMavenDependency.Builder from(MavenDependency instance)
      Fill a builder with attribute values from the provided io.github.ascopes.protobufmavenplugin.dependencies.MavenDependency instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • groupId

      public final ImmutableMavenDependency.Builder groupId(String groupId)
      Initializes the value for the groupId attribute.
      Parameters:
      groupId - The value for groupId (can be null)
      Returns:
      this builder for use in a chained invocation
    • artifactId

      public final ImmutableMavenDependency.Builder artifactId(String artifactId)
      Initializes the value for the artifactId attribute.
      Parameters:
      artifactId - The value for artifactId (can be null)
      Returns:
      this builder for use in a chained invocation
    • version

      public final ImmutableMavenDependency.Builder version(String version)
      Initializes the value for the version attribute.
      Parameters:
      version - The value for version (can be null)
      Returns:
      this builder for use in a chained invocation
    • type

      public final ImmutableMavenDependency.Builder type(@Nullable String type)
      Initializes the value for the type attribute.
      Parameters:
      type - The value for type (can be null)
      Returns:
      this builder for use in a chained invocation
    • classifier

      public final ImmutableMavenDependency.Builder classifier(@Nullable String classifier)
      Initializes the value for the classifier attribute.
      Parameters:
      classifier - The value for classifier (can be null)
      Returns:
      this builder for use in a chained invocation
    • dependencyResolutionDepth

      public final ImmutableMavenDependency.Builder dependencyResolutionDepth(@Nullable DependencyResolutionDepth dependencyResolutionDepth)
      Initializes the value for the dependencyResolutionDepth attribute.
      Parameters:
      dependencyResolutionDepth - The value for dependencyResolutionDepth (can be null)
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableMavenDependency build()
      Returns:
      An immutable instance of MavenDependency
      Throws:
      IllegalStateException - if any required attributes are missing