Enum Class Scope

java.lang.Object
java.lang.Enum<Scope>
org.openrewrite.maven.tree.Scope
All Implemented Interfaces:
Serializable, Comparable<Scope>, Constable

public enum Scope extends Enum<Scope>
  • Enum Constant Details

    • None

      public static final Scope None
    • Compile

      public static final Scope Compile
    • Provided

      public static final Scope Provided
    • Runtime

      public static final Scope Runtime
    • Test

      public static final Scope Test
    • System

      public static final Scope System
    • Import

      public static final Scope Import
    • Invalid

      public static final Scope Invalid
  • Method Details

    • values

      public static Scope[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Scope valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isInClasspathOf

      public boolean isInClasspathOf(@Nullable Scope scope)
      Parameters:
      scope - The scope to test
      Returns:
      If a dependency in this scope would be in the classpath of the tested scope.
    • transitiveOf

      public @Nullable Scope transitiveOf(@Nullable Scope scope)
      See the table at https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#dependency-scope. this represents the scope on the top row of the table.
      Parameters:
      scope - The scope on the left column of the table.
      Returns:
      The scope inside the table.
    • fromName

      public static Scope fromName(@Nullable String scope)
    • maxPrecedence

      public static @Nullable Scope maxPrecedence(@Nullable Scope scope1, @Nullable Scope scope2)
      Give two scopes, returns the scope with the highest precedence.
      Returns:
      Scope with the higher precedence.
    • asGradleConfigurationName

      @Deprecated public static @Nullable String asGradleConfigurationName(@Nullable Scope scope)
      Deprecated.
      There are more, and more complex, gradle dependency configurations than there are maven scopes.

      In Maven you place a dependency that should be available at runtime but not at compile time into the "runtime" scope. In Gradle you place a dependency that should be available at runtime but not at compile time into the "runtimeOnly" configuration. In this situation you should use asConsumableGradleConfigurationName(org.openrewrite.maven.tree.Scope).

      In Maven you read the runtime classpath from the "runtime" scope. In Gradle you read the runtime classpath from the "runtimeClasspath" configuration. In this situation you should use asResolvableGradleConfigurationName(org.openrewrite.maven.tree.Scope).

      This method is deprecated because its name is ambiguous about which of these possible mappings it is referring to.

    • asConsumableGradleConfigurationName

      public static @Nullable String asConsumableGradleConfigurationName(@Nullable Scope scope)
      Use when you want to know which Gradle configuration you should *add* an entry to in order to most closely match a given Maven scope.
    • asResolvableGradleConfigurationName

      public static @Nullable String asResolvableGradleConfigurationName(@Nullable Scope scope)
      Use when you want to know which Gradle configuration you should *read* to get contents similar to a given Maven scope.