You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine I want to create a new annotation. That annotation that accepts
additional fields for configuring the service implementation. My implementing
classes can of course have my new annotation and the ProviderFor annotation,
but it's a bit redundant.
Instead, I want to apply the ProviderFor annotation on my new annotation. Then
any class with my new annotation should automatically work as if the
providerFor annotation were applied.
@ProviderFor(RequestHandler.class)
public @interface CustomAnnotation {
String name();
int value();
}
@CustomAnnoation(name="example", value=25)
public class HelloHandler {
...
}
When I do a ServiceLoader.load(RequestHandler.class), HelloHandler should be
loaded. I don't need to apply @ProviderFor to it, because I already indicated
in the CustomAnnotation that any class with that annotation applied is a
provider for the RequestHandler class.
Obviously you can't automatically add the provider for annotation to the
implementing class. Instead I would expect the annotation processor to
determine that CustomAnnotation had ProviderFor applied. Then the annotation
processor would know anything with CustomAnnotation should be operated on as if
ProviderFor(RequestHandler.class) had been present.
Original issue reported on code.google.com by [email protected] on 17 Apr 2013 at 5:21
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 17 Apr 2013 at 5:21The text was updated successfully, but these errors were encountered: