Knopflerfish OSGi 6.0.0

org.osgi.service.component.annotations
Annotation Type Reference


@Retention(value=CLASS)
@Target(value={METHOD,FIELD})
public @interface Reference

Identify the annotated member as a reference of a Service Component.

When the annotation is applied to a method, the method is the bind method of the reference. When the annotation is applied to a field, the field will contain the bound service(s) of the reference.

This annotation is not processed at runtime by Service Component Runtime. It must be processed by tools and used to add a Component Description to the bundle.

In the generated Component Description for a component, the references must be ordered in ascending lexicographical order (using String.compareTo ) of the reference names.

Author:
$Id: b13bbef27d561774539baec5c5120b20255f72ad $
See Also:
"The reference element of a Component Description."

Optional Element Summary
 java.lang.String bind
          The name of the bind method for this reference.
 ReferenceCardinality cardinality
          The cardinality of this reference.
 java.lang.String field
          The name of the field for this reference.
 FieldOption fieldOption
          The field option for this reference.
 java.lang.String name
          The name of this reference.
 ReferencePolicy policy
          The policy for this reference.
 ReferencePolicyOption policyOption
          The policy option for this reference.
 ReferenceScope scope
          The reference scope for this reference.
 java.lang.Class<?> service
          The type of the service for this reference.
 java.lang.String target
          The target property for this reference.
 java.lang.String unbind
          The name of the unbind method for this reference.
 java.lang.String updated
          The name of the updated method for this reference.
 

name

public abstract java.lang.String name
The name of this reference.

The name of this reference must be specified when using this annotation in the Component.reference() element since there is no annotated member from which the name can be determined. If not specified, the name of this reference is based upon how this annotation is used:

See Also:
"The name attribute of the reference element of a Component Description."
Default:
""

service

public abstract java.lang.Class<?> service
The type of the service for this reference.

The type of the service for this reference must be specified when using this annotation in the Component.reference() element since there is no annotated member from which the type of the service can be determined.

If not specified, the type of the service for this reference is based upon how this annotation is used:

See Also:
"The interface attribute of the reference element of a Component Description."
Default:
java.lang.Object.class

cardinality

public abstract ReferenceCardinality cardinality
The cardinality of this reference.

If not specified, the cardinality of this reference is based upon how this annotation is used:

See Also:
"The cardinality attribute of the reference element of a Component Description."
Default:
org.osgi.service.component.annotations.ReferenceCardinality.MANDATORY

policy

public abstract ReferencePolicy policy
The policy for this reference.

If not specified, the policy of this reference is based upon how this annotation is used:

See Also:
"The policy attribute of the reference element of a Component Description."
Default:
org.osgi.service.component.annotations.ReferencePolicy.STATIC

target

public abstract java.lang.String target
The target property for this reference.

If not specified, no target property is set.

See Also:
"The target attribute of the reference element of a Component Description."
Default:
""

policyOption

public abstract ReferencePolicyOption policyOption
The policy option for this reference.

If not specified, the RELUCTANT reference policy option is used.

Since:
1.2
See Also:
"The policy-option attribute of the reference element of a Component Description."
Default:
org.osgi.service.component.annotations.ReferencePolicyOption.RELUCTANT

scope

public abstract ReferenceScope scope
The reference scope for this reference.

If not specified, the bundle reference scope is used.

Since:
1.3
See Also:
"The scope attribute of the reference element of a Component Description."
Default:
org.osgi.service.component.annotations.ReferenceScope.BUNDLE

bind

public abstract java.lang.String bind
The name of the bind method for this reference.

If specified and this reference annotates a method, the specified name must match the name of the annotated method.

If not specified, the name of the bind method is based upon how this annotation is used:

If there is a bind method name, the component must contain a method with that name.

Since:
1.3
See Also:
"The bind attribute of the reference element of a Component Description."
Default:
""

updated

public abstract java.lang.String updated
The name of the updated method for this reference.

If not specified, the name of the updated method is based upon how this annotation is used:

If there is an updated method name, the component must contain a method with that name.

Since:
1.2
See Also:
"The updated attribute of the reference element of a Component Description."
Default:
""

unbind

public abstract java.lang.String unbind
The name of the unbind method for this reference.

If not specified, the name of the unbind method is based upon how this annotation is used:

If there is an unbind method name, the component must contain a method with that name.

See Also:
"The unbind attribute of the reference element of a Component Description."
Default:
""

field

public abstract java.lang.String field
The name of the field for this reference.

If specified and this reference annotates a field, the specified name must match the name of the annotated field.

If not specified, the name of the field is based upon how this annotation is used:

If there is a field name, the component must contain a field with that name.

Since:
1.3
See Also:
"The field attribute of the reference element of a Component Description."
Default:
""

fieldOption

public abstract FieldOption fieldOption
The field option for this reference.

If not specified, the field option is based upon how this annotation is used:

Since:
1.3
See Also:
"The field-option attribute of the reference element of a Component Description."
Default:
org.osgi.service.component.annotations.FieldOption.REPLACE

Knopflerfish OSGi 6.0.0