oracle.dbtools.plugin.api.di.annotations

## Annotation Type Priority

-     @Retention(value=RUNTIME)
       @Target(value=TYPE)
      public @interface Priority

  Annotates types with a priority value. The priority is split into two components:

  - ``ring()``- A zero based numeric value where 0 is the highest priority ring, `Integer.MAX_VALUE` is the lowest priority ring.
  - ``value()``- A zero based numeric value where `Integer.MAX_VALUE` is the highest priority value, 0 is the lowest priority value.

  The `Priority` value of a type is used to choose which type to use when multiples types provide (via the `Provides` annotation) the same service.

  ### Examples

  #### Redundant

       @Priority
       class Foo {...}

  Redundant annotation, gives the type the default `ring()` and `value()` values. A log message should be produced at the `WARNING` level if a default Priority annotation is encountered as it likely indicates a coding error.

  #### Default Ring, different priority

       @Priority(1)
       class Foo {...}
       @Priority(2)
       class Bar {...}

  Type `Bar` will be chosen over type `Foo` because they belong to the same ring and `Bar` has a higher priority value than `Foo`.

  #### Different Ring, default priority

       @Priority(ring=0)
       class Foo {...}
       @Priority(ring=1)
       class Bar {...}

  Type `Foo` will be chosen over type `Bar` because `Foo` belongs to a higher priority ring than `Bar`.

  #### Different Ring, different priority

       @Priority(ring=3,value=9)
       class Foo {...}
       @Priority(ring=1,value=2)
       class Bar {...}

  Type `Bar` will be chosen over type `Foo` because `Bar` belongs to a higher priority ring than `Foo`.

  Author:
    cdivilly

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `int` | `ring` Identifies the 'ring' that this priority is classified into.
    `int` | `value` Orders types within a single `ring()` classification.

- - ### Element Detail

    - #### ring

          public abstract int ring

      Identifies the 'ring' that this priority is classified into. Ring 0 is the highest priority ring.
      Returns:
        A positive integer value representing the 'ring' that this `Priority` belongs to.
      Default:
        2147483647

  - - #### value

          public abstract int value

      Orders types within a single `ring()` classification. Priority `Integer.MAX_VALUE` is the highest priority
      Returns:
        A positive integer representing the position within this `ring()`
      Default:
        0

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