I would like to annotate a constructor like this:
@Inject Constructor(
@Some("abc") String abc,
@Some("rst") String rst,
@Some("xyz") BigInteger xyz
)
Now when creating an instance of that class I would like to provide values for abc
, rst
, and xyz
to dynamically depend on the values of the @Some
annotation.
That is I am NOT looking for annotatedWith
or annotatedWithName
but I am looking for something that allows me to do the injection dynamically, i.e. something hypothetically like:
@DynamicProvider
public T provide(Context[T] injectionContext) {
if (injectionContext.getType == String.class) {
return (T) lookupString(injectionContext.getAnnotation(Some.class).value)
}
// etc
}