Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

QualifierMatchers

Michael Ekstrand edited this page Jul 11, 2013 · 1 revision

Qualifier Matchers

Grapht matches qualifiers using qualifier matchers. These match the qualifier attached to a dependency, if any, and control whether certain binding rules are active. They also contribute to the ordering of binding rules: generally, a more-specific qualifier matcher takes precedence over a less-specific one.

The matchers, in increasing order of priority:

  1. Default policy (matches unqualified dependencies and dependencies whose qualifiers are annotated with @AllowUnqualifiedMatch)
  2. Any qualifier (including none)
  3. Annotation type (matches all dependencies with qualifiers of a specified type)
  4. Exact (matches all dependencies qualified with a specific annotation value; explicit no-qualifier matches are exact matches on the null qualifier)

For most qualifier annotations, there is no difference between 3 and 4. The difference becomes relevant with qualifier annotations that can take a value, such as @Named.

Clone this wiki locally