@Retention(value=CLASS)
@Target(value={METHOD,FIELD})
public @interface Reference
bind
method of a Service
Component.
The annotated method is a bind method of the Component.
This annotation is not processed at runtime by a Service Component Runtime implementation. 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 name
s.
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
bind
The name of the bind method for this reference.
|
ReferenceCardinality |
cardinality
The cardinality of the 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 the 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 to bind to this reference.
|
java.lang.String |
target
The target filter for the reference.
|
java.lang.String |
unbind
The name of the unbind method for this reference.
|
java.lang.String |
updated
The name of the updated method which is associated with the annotated
bind method.
|
public abstract java.lang.String name
If not specified, the name of this reference is based upon the name of
the method being annotated. If the method name begins with bind
,
set
or add
, that is removed.
public abstract java.lang.Class<?> service
If not specified, the type of the service to bind is based upon the type of the first argument of the method being annotated.
public abstract ReferenceCardinality cardinality
If not specified, the reference has a
1..1
cardinality.
public abstract ReferencePolicy policy
If not specified, the STATIC
reference
policy is used.
public abstract java.lang.String target
public abstract ReferencePolicyOption policyOption
If not specified, the RELUCTANT
reference policy option is used.
public abstract ReferenceScope scope
If not specified, the name of the unbind method is derived from the name
of the annotated bind method. If the annotated method name begins with
bind
, set
or add
, that is replaced with
unbind
, unset
or remove
, respectively, to derive
the unbind method name. Otherwise, un
is prefixed to the
annotated method name to derive the unbind method name. The unbind method
is only set if the component type contains a method with the derived
name.
public abstract java.lang.String bind
If not specified, the RELUCTANT
reference policy option is used.
If not specified, the name of the bind method is based upon how this annotation is used:
Component.reference()
element - There is no bind method name.
If there is a bind method name, the component must contain a method with that name.
public abstract java.lang.String updated
To declare no updated method, the value "-"
must be used.
If not specified, the name of the updated method is derived from the name
of the annotated bind method. If the annotated method name begins with
bind
, set
or add
, that is replaced with
updated
to derive the updated method name. Otherwise,
updated
is prefixed to the annotated method name to derive the
updated method name. The updated method is only set if the component type
contains a method with the derived name.
public abstract java.lang.String unbind
If not specified, the name of the unbind method is based upon how this annotation is used:
bind
, set
or add
, that prefix is replaced
with unbind
, unset
or remove
, respectively, to
create the name candidate for the unbind method. Otherwise, un
is
prefixed to the name of the annotated method to create the name candidate
for the unbind method. If the component type contains a method with the
candidate name, the candidate name is used as the name of the unbind
method. To declare no unbind method when the component type contains a
method with the candidate name, the value "-"
must be used.Component.reference()
element - There is no unbind method
name.If there is an unbind method name, the component must contain a method with that name.
public abstract java.lang.String field
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:
Component.reference()
element - There is no field name.If there is a field name, the component must contain a field with that name.
public abstract FieldOption fieldOption
If not specified, the field option is based upon how this annotation is used:
ReferencePolicy.DYNAMIC
, the cardinality is
0..n
or
1..n
, and the field is declared
final
, the field option is FieldOption.UPDATE
. Otherwise,
the field option is FieldOption.REPLACE
Component.reference()
element - There is no field option.