ReferenceScope
Date: 2016-06-25

org.osgi.service.component.annotations

## Enum ReferenceScope

- java.lang.Object
- - java.lang.Enum<ReferenceScope>
  - - org.osgi.service.component.annotations.ReferenceScope

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ReferenceScope>

      public enum ReferenceScope
      extends java.lang.Enum<ReferenceScope>

  Reference scope for the `Reference` annotation.
  Since:
    1.3

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `BUNDLE` A single service object is used for all references to the service in this bundle.
    `PROTOTYPE` If the bound service has prototype service scope, then each instance of the component with this reference can receive a unique instance of the service.
    `PROTOTYPE_REQUIRED` Bound services must have prototype service scope.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `toString()`
    `static ReferenceScope` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static ReferenceScope[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### BUNDLE

          public static final ReferenceScope BUNDLE

      A single service object is used for all references to the service in this bundle.

    - #### PROTOTYPE

          public static final ReferenceScope PROTOTYPE

      If the bound service has prototype service scope, then each instance of the component with this reference can receive a unique instance of the service. If the bound service does not have prototype service scope, then this reference scope behaves the same as `BUNDLE`.

    - #### PROTOTYPE_REQUIRED

          public static final ReferenceScope PROTOTYPE_REQUIRED

      Bound services must have prototype service scope. Each instance of the component with this reference can receive a unique instance of the service.

  - ### Method Detail

    - #### values

          public static ReferenceScope[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (ReferenceScope c : ReferenceScope.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static ReferenceScope valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Enum<ReferenceScope>`