Qualifier
A qualifier annotation can be used to qualify or otherwise disambiguate a type on a dependency graph. This is useful for primarily two situations:
You have two of the same type on the graph and need to disambiguate them.
You have a common type (such as a primitive) on the graph that you want to add more explicit semantics to.
Any annotation annotated with Qualifier becomes a "qualifier" annotation that will be recognized and respected by the Metro compiler plugin.
@Qualifier
annotation class QualifiedInt
@DependencyGraph
interface AppGraph {
val int: Int
@QualifiedInt val qualifiedInt: Int
}
Content copied to clipboard
Metro's runtime contains two out-of-the box qualifiers for common use: Named and ForScope.