org.apache.felix.scr.annotations

## Annotation Type Reference

Deprecated.
Use the OSGi annotations from org.osgi.service.component.annotations.*

    @Target(value={TYPE,FIELD})
    @Retention(value=CLASS)
    @Documented
    @Deprecated
    public @interface Reference

The `Reference` annotation defines references to other services made available to the component by the Service Component Runtime.

This annotation may be declared for a Java Class or any Java Field to which it might apply. Depending on where the annotation is declared, the parameters may have different default values.

This annotation is used to declare <reference> elements of the component declaration. See section 112.4.7, Reference Element, in the OSGi Service Platform Service Compendium Specification for more information.

### Optional Element Summary

Optional Elements
`String` `bind` Deprecated. The name of the method to be called when the service is to be bound to the component.
`ReferenceCardinality` `cardinality` Deprecated. The cardinality of the service reference.
`String` `name` Deprecated. The local name of the reference.
`ReferencePolicy` `policy` Deprecated. The dynamicity policy of the reference.
`ReferencePolicyOption` `policyOption` Deprecated. The policy option for the reference
`Class<?>` `referenceInterface` Deprecated. The name of the service interface.
`ReferenceStrategy` `strategy` Deprecated. The reference strategy for the reference.
`String` `target` Deprecated. A service target filter to select specific services to be made available.
`String` `unbind` Deprecated. The name of the method to be called when the service is to be unbound from the component.
`String` `updated` Deprecated. The name of the method to be called when the bound service updates its service registration properties.

### Element Detail

#### name

    public abstract String name

Deprecated.
The local name of the reference. If the annotation is declared on class level, this parameter is required. If the tag is declared for a field, the default value for the name parameter is the name of the field.

Default:
  ""

#### referenceInterface

    public abstract Class<?> referenceInterface

Deprecated.
The name of the service interface. This name is used by the Service Component Runtime to access the service on behalf of the component. If the annotation is declared on class level, this parameter is required. If the annotation is declared for a field, the default value for the interface parameter is the type of the field.

Default:
  org.apache.felix.scr.annotations.AutoDetect.class

#### cardinality

    public abstract ReferenceCardinality cardinality

Deprecated.
The cardinality of the service reference. This must be one of 0..1, 1..1, 0..n, and 1..n.

Default:
  org.apache.felix.scr.annotations.ReferenceCardinality.MANDATORY_UNARY

#### policy

    public abstract ReferencePolicy policy

Deprecated.
The dynamicity policy of the reference. If dynamic the service will be made available to the component as it comes and goes. If static the component will be deactivated and re-activated if the service comes and/or goes away.

Default:
  org.apache.felix.scr.annotations.ReferencePolicy.STATIC

#### policyOption

    public abstract ReferencePolicyOption policyOption

Deprecated.
The policy option for the reference

Since:
  1.7

Default:
  org.apache.felix.scr.annotations.ReferencePolicyOption.RELUCTANT

#### target

    public abstract String target

Deprecated.
A service target filter to select specific services to be made available. In order to be able to overwrite the value of this value by a configuration property, this parameter must be declared. If the parameter is not declared, the respective declaration attribute will not be generated.

Default:
  ""

#### bind

    public abstract String bind

Deprecated.
The name of the method to be called when the service is to be bound to the component. The default value is the name created by appending the reference name to the string bind. The method must be declared `public` or `protected` and take single argument which is declared with the service interface type.

Default:
  ""

#### unbind

    public abstract String unbind

Deprecated.
The name of the method to be called when the service is to be unbound from the component. The default value is the name created by appending the reference name to the string unbind. The method must be declared `public` or `protected` and take single argument which is declared with the service interface type.

Default:
  ""

#### updated

    public abstract String updated

Deprecated.
The name of the method to be called when the bound service updates its service registration properties. By default this is not set.

Default:
  ""

#### strategy

    public abstract ReferenceStrategy strategy

Deprecated.
The reference strategy for the reference. This can either be `ReferenceStrategy.EVENT` in which case the bind and unbind methods are used or it can be `ReferenceStrategy.LOOKUP` in which case the reference is looked up through the component context.

Default:
  org.apache.felix.scr.annotations.ReferenceStrategy.EVENT