oracle.dbtools.plugin.api.types

## Interface TypeQualifier<T>

- Type Parameters:
    `T` - The type of the service

      public interface TypeQualifier<T>

  Qualifies the specific type of a service to be discovered via `InstanceLocator`. Note that whilst JSR-330 supports the notion of arbitrary `Qualifier`s, this framework only supports the use of the `Named` qualifier.
  Since:
    19.3.0
  Author:
    cdivilly

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `TypeQualifier.Builder<T>` Build `TypeQualifier` instances
    `static class` | `TypeQualifier.MatchingMode` Determines how the `TypeQualifier` matches types

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> TypeQualifier<T>` | `any(Class<T> type)` Matches any `TypeQualifier` of the specified type, ignoring any `Qualifier`s on the type
    `String` | `declaration()` Provides the source code for this `TypeQualifier`
    `boolean` | `equals(Object obj)`
    `static <T> TypeQualifier<T>` | `from(Class<T> type, Annotation... qualifiers)` Deprecated. use `named(Class, String)`, `any(Class)` or `provides(Class)` to more accurately identify the `TypeQualifier`
    `static <T> TypeQualifier<T>` | `from(Class<T> type, Iterable<? extends Annotation> qualifiers)` Deprecated. use `named(Class, String)`, `any(Class)` or `provides(Class)` to more accurately identify the `TypeQualifier`
    `int` | `hashCode()`
    `boolean` | `isEmpty()` Returns true if the qualifier has no annotation qualifiers, false otherwise
    `boolean` | `matches(TypeQualifier<?> other)` Determines if this `TypeQualifier` is a match for the specified `TypeQualifier`
    `boolean` | `matches(TypeReflection<?> type)` Determines if this `TypeQualifier` is a match for the specified type
    `TypeQualifier.MatchingMode` | `matchingMode()` Indicates how types are matched
    `String` | `name()` Returns the name constraint of this `TypeQualifier` if any.
    `static <T> TypeQualifier<T>` | `named(Class<T> type, String name)` Construct a `TypeQualifier` for the specified type and name
    `default TypeQualifier<?>` | `normalize()` Normalize a potentially primitive type (e.g int.class) to it's boxed equivalent (e.g.
    `static <T> TypeQualifier<T>` | `provides(Class<T> type)` Represents a provider of the specified service
    `String` | `toString()`
    `Class<T>` | `type()` The type of the instance to find
    `static <T> TypeQualifier<T>` | `type(Class<T> type)` Selects the specified concrete type
    `<E> TypeQualifier<E>` | `withType(Class<E> type)` Override this `TypeQualifier` to produce a new instance that uses the specified type

- - ### Method Detail

    - #### declaration

          String declaration()

      Provides the source code for this `TypeQualifier`
      Returns:
        Text representing how this qualifier would be instantiated in source code

    - #### equals

          boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### isEmpty

          boolean isEmpty()

      Returns true if the qualifier has no annotation qualifiers, false otherwise
      Returns:
        true if the qualifier only denotes a type, i.e. has zero `Qualifier` annotations, false otherwise

    - #### matches

          boolean matches(TypeQualifier<?> other)

      Determines if this `TypeQualifier` is a match for the specified `TypeQualifier`
      Parameters:
        `other` - The qualifier to test against
      Returns:
        true if there is a match, false otherwise

    - #### matches

          boolean matches(TypeReflection<?> type)

      Determines if this `TypeQualifier` is a match for the specified type
      Parameters:
        `type` - The type to test again
      Returns:
        true if the qualifier matches, false otherwise

    - #### matchingMode

          TypeQualifier.MatchingMode matchingMode()

      Indicates how types are matched
      Returns:
        `TypeQualifier.MatchingMode` instance

    - #### name

          String name()

      Returns the name constraint of this `TypeQualifier` if any.
      Returns:
        Name constraint, or null if this qualifier does not have a `Named` constraint

    - #### withType

          <E> TypeQualifier<E> withType(Class<E> type)

      Override this `TypeQualifier` to produce a new instance that uses the specified type
      Type Parameters:
        `E` - The overidden type of the qualifier
      Parameters:
        `type` - The new type
      Returns:
        `TypeQualifier` instance

    - #### toString

          String toString()

      Overrides:
        `toString` in class `Object`

    - #### type

          Class<T> type()

      The type of the instance to find
      Returns:
        The type to find

    - #### any

          static <T> TypeQualifier<T> any(Class<T> type)

      Matches any `TypeQualifier` of the specified type, ignoring any `Qualifier`s on the type
      Type Parameters:
        `T` - The type of the service
      Parameters:
        `type` - The type of the service
      Returns:
        `TypeQualifier` instance

    - #### from

          @Deprecated
          static <T> TypeQualifier<T> from(Class<T> type,
                                                       Annotation... qualifiers)

      Deprecated. use `named(Class, String)`, `any(Class)` or `provides(Class)` to more accurately identify the `TypeQualifier`
      Construct an `TypeQualifier` from the specified `Annotations`. Note only the `Named` qualifier annotation is considered. Arbitrary `Qualifier` annotations are not supported as it is not possible to optimize their use for compile time dependency injection
      Type Parameters:
        `T` - The type of the service
      Parameters:
        `type` - The Type of the service
        `qualifiers` - The set of annotations to examine
      Returns:
        `TypeQualifier` instance

    - #### from

          @Deprecated
          static <T> TypeQualifier<T> from(Class<T> type,
                                                       Iterable<? extends Annotation> qualifiers)

      Deprecated. use `named(Class, String)`, `any(Class)` or `provides(Class)` to more accurately identify the `TypeQualifier`
      Construct an `TypeQualifier` from the specified `Annotations`. Note only the `Named` qualifier annotation is considered. Arbitrary `Qualifier` annotations are not supported as it is not possible to optimize their use for compile time dependency injection
      Type Parameters:
        `T` - The type of the service
      Parameters:
        `type` - The Type of the service
        `qualifiers` - The set of annotations to examine
      Returns:
        `TypeQualifier` instance

    - #### named

          static <T> TypeQualifier<T> named(Class<T> type,
                                            String name)

      Construct a `TypeQualifier` for the specified type and name
      Type Parameters:
        `T` - The type of the service
      Parameters:
        `type` - The type of the service
        `name` - The `Named` qualifier bound to the service
      Returns:
        `TypeQualifier` instance

    - #### provides

          static <T> TypeQualifier<T> provides(Class<T> type)

      Represents a provider of the specified service
      Type Parameters:
        `T` - The type of the service
      Parameters:
        `type` - The type of the service
      Returns:
        `TypeQualifier` instance

    - #### type

          static <T> TypeQualifier<T> type(Class<T> type)

      Selects the specified concrete type
      Type Parameters:
        `T` - The type of the service
      Parameters:
        `type` - The exact type to select
      Returns:
        `TypeQualifier` instance

    - #### normalize

          default TypeQualifier<?> normalize()

      Normalize a potentially primitive type (e.g int.class) to it's boxed equivalent (e.g. Integer.class).
      Returns:
        Self, unless this qualifier uses a primitive type, it's boxed equivalent

Copyright © 2010, 2022, Oracle and/or its affiliates.