org.apache.felix.ipojo.annotations

## Annotation Type Requires

    @Target(value={FIELD,PARAMETER,ANNOTATION_TYPE})
     @Inherited
    public @interface Requires

This annotation declares a service requirement.

Author:
  Felix Project Team

### Optional Element Summary

Optional Elements
`Class<? extends Comparator>` `comparator` Set the comparator.
`Class` `defaultimplementation` Set the default-implementation to use if the dependency is optional, and no providers are available.
`Class<? extends RuntimeException>` `exception` Set the exception to throw when the service is not available.
`String` `filter` Set the LDAP filter of the dependency.
`String` `from` Set the from attribute.
`String` `id` Set the dependency id.
`boolean` `nullable` Enable / Disable nullable pattern.
`boolean` `optional` Set if the dependency is optional.
`BindingPolicy` `policy` Set the binding policy.
`boolean` `proxy` Set to true if the service dependency is injected as a proxy.
`Class` `specification` Set the required service specification.
`int` `timeout` Set the time to wait before applying the 'no service available' action.

### Element Detail

#### filter

    public abstract String filter

Set the LDAP filter of the dependency. Default : no filter

Default:
  ""

#### optional

    public abstract boolean optional

Set if the dependency is optional. Default : false

Default:
  false

#### id

    public abstract String id

Set the dependency id. Default : empty

Default:
  ""

#### nullable

    public abstract boolean nullable

Enable / Disable nullable pattern. Default : true

Default:
  true

#### defaultimplementation

    public abstract Class defaultimplementation

Set the default-implementation to use if the dependency is optional, and no providers are available. The class must implement the required service interface. Default : no default-implementation

Default:
  java.lang.Class.class

#### exception

    public abstract Class<? extends RuntimeException> exception

Set the exception to throw when the service is not available. This attribute can only be used for optional dependencies. It must be a subclass of `RuntimeException`. Default: no exception.

Default:
  java.lang.RuntimeException.class

#### policy

    public abstract BindingPolicy policy

Set the binding policy. Acceptable policy are dynamic, static and dynamic-priority. Default: dynamic.

Default:
  org.apache.felix.ipojo.annotations.BindingPolicy.DYNAMIC

#### comparator

    public abstract Class<? extends Comparator> comparator

Set the comparator. The indicated class must implement `Comparator`

Default:
  java.util.Comparator.class

#### from

    public abstract String from

Set the from attribute.

Default:
  ""

#### specification

    public abstract Class specification

Set the required service specification. This attribute is required for Collection field.

Default:
  java.lang.Object.class

#### proxy

    public abstract boolean proxy

Set to true if the service dependency is injected as a proxy. Default: true

Default:
  true

#### timeout

    public abstract int timeout

Set the time to wait before applying the 'no service available' action. This attribute is only valid for optional dependencies. The time is set in milliseconds. Default: no timeout

Default:
  -1