Class ImmutableMavenDependency

java.lang.Object
io.github.ascopes.protobufmavenplugin.dependencies.ImmutableMavenDependency
All Implemented Interfaces:
MavenArtifact, MavenDependency

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableMavenDependency extends Object implements MavenDependency
Immutable implementation of MavenDependency.

Use the builder to create immutable instances: ImmutableMavenDependency.builder().

  • Field Details

    • groupId

      private final String groupId
    • artifactId

      private final String artifactId
    • version

      private final @Nullable String version
    • type

      private final @Nullable String type
    • classifier

      private final @Nullable String classifier
    • dependencyResolutionDepth

      private final @Nullable DependencyResolutionDepth dependencyResolutionDepth
    • exclusions

      private final Set<MavenExclusionBean> exclusions
  • Constructor Details

  • Method Details

    • getGroupId

      public String getGroupId()
      Get the group ID.
      Specified by:
      getGroupId in interface MavenArtifact
      Returns:
      the group ID.
    • getArtifactId

      public String getArtifactId()
      Get the artifact ID.
      Specified by:
      getArtifactId in interface MavenArtifact
      Returns:
      the artifact ID.
    • getVersion

      public @Nullable String getVersion()
      Get the artifact version.

      May be null if we expect to discover the version from dependency management.

      Specified by:
      getVersion in interface MavenArtifact
      Returns:
      the version.
    • getType

      public @Nullable String getType()
      Get the artifact type.

      May be null if the default should be used.

      Specified by:
      getType in interface MavenArtifact
      Returns:
      the artifact type.
    • getClassifier

      public @Nullable String getClassifier()
      Get the artifact classifier.

      May be null if no classifier is set.

      Specified by:
      getClassifier in interface MavenArtifact
      Returns:
      the artifact classifier.
    • getDependencyResolutionDepth

      public @Nullable DependencyResolutionDepth getDependencyResolutionDepth()
      Get the preferences for the depth of dependency resolution.

      May be null if the default should be used.

      Specified by:
      getDependencyResolutionDepth in interface MavenArtifact
      Returns:
      the preference for the depth of dependency resolution.
    • getExclusions

      public Set<MavenExclusionBean> getExclusions()
      Get a set of dependency exclusions to apply when resolving dependencies.
      Specified by:
      getExclusions in interface MavenArtifact
      Returns:
      the exclusions, which by default is empty.
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableMavenDependency that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableMavenDependency another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: groupId, artifactId, version, type, classifier, dependencyResolutionDepth, exclusions.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value MavenDependency with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • builder

      public static ImmutableMavenDependency.Builder builder()
      Creates a builder for ImmutableMavenDependency.
       ImmutableMavenDependency.builder()
          .groupId(String | null) // nullable groupId
          .artifactId(String | null) // nullable artifactId
          .version(@org.jspecify.annotations.Nullable String | null) // nullable version
          .type(@org.jspecify.annotations.Nullable String | null) // nullable type
          .classifier(@org.jspecify.annotations.Nullable String | null) // nullable classifier
          .dependencyResolutionDepth(io.github.ascopes.protobufmavenplugin.dependencies.@org.jspecify.annotations.Nullable DependencyResolutionDepth | null) // nullable dependencyResolutionDepth
          .addExclusions|addAllExclusions(MavenExclusionBean) // exclusions elements
          .build();
       
      Returns:
      A new ImmutableMavenDependency builder
    • createSafeList

      private static <T> List<T> createSafeList(Iterable<? extends T> iterable, boolean checkNulls, boolean skipNulls)
    • createUnmodifiableSet

      private static <T> Set<T> createUnmodifiableSet(List<T> list)
      Unmodifiable set constructed from list to avoid rehashing.