# Package org.qi4j.api.service.qualifier

Service Qualifiers.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  AnnotationQualifier<QUALIFIER extends Annotation> | Constructs a Specification for a given qualifier annotation

- Class Summary
  Class | Description
  --- | ---
  Active.ActiveQualifier | Active Annotation Qualifier.
  Available.AvailableQualifier | Available Annotation Qualifier.
  HasMetaInfo.HasMetaInfoQualifier | HasMetaInfo Annotation Qualifier.
  IdentifiedBy.IdentifiedByQualifier | IdentifiedBy Annotation Qualifier.
  ServiceQualifier | This class helps you select a particular service from a list.
  ServiceTags | Use this as metainfo about a Service to specify tags.
  Tagged.TaggedQualifier | Tagged Annotation Qualifier.

- Annotation Types Summary
  Annotation Type | Description
  --- | ---
  Active | Filter services based on whether they are active or not.
  Available | Filter services based on whether they are available or not.
  HasMetaInfo | Filter services based on Meta Info being declared on the Service.
  IdentifiedBy | Filter services based on identity.
  Qualifier | Annotation used to declare Qualifiers annotations.
  Tagged | Filter services based on tags.

## Package org.qi4j.api.service.qualifier Description

## Service Qualifiers.

The @Service injection is only able to specify the type of the service to be injected. If any other type of qualification has to be done it has to be done manually but for common cases it's more convenient to use annotations to do this filtering. This package contains annotations to perform this qualification.

Example:

>     @Service @Tagged( "sometag" ) MyService service;

This will only inject instances of MyService that have been tagged with "sometag". If none exist an exception will occur at injection time since it is not optional.

It also works with iterables:

>     @Service @Tagged( "sometag" ) Iterable<MyService> services;

The qualification will be evaluated upon each call to iterator(), and since the qualifier has access to a ServiceReference, which contains the isActive() method, it can even provide some dynamicity.

>     @Service @Active Iterable<SomeImportedService> importedServices;

Let's say these SomeImportedService are only sometimes available. Then whenever iterator() is called the `Active` tag can kick in and filter out those whose ServiceReference.isActive() returns false.

Standard ones defined in the API are:

- `Active`
- `Available`
- `HasMetaInfo`
- `IdentifiedBy`
- `Tagged`

See tests and API for more examples, and how to implement your own qualifiers.