glassfish-hk2
glassfish-hk2 copied to clipboard
Ability to Add Arbitrary Metadata to Services via Annotation
I'd like to add additional metadata to a service via annotation. The current implementation of @Metadata requires that an annotation be a qualifier or scope annotation in order to add metadata which precludes me from being able to directly add metadata to a service and retrieve it later without having to qualify/scope it. For example, I would like to be able to do this:
//notice there is no qualifier or scope annotation @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MyServiceMetadata {
@Metadata("myMetadata")
String value();
}
@MyServiceMetadata("something")
@Service
public class MyService {
}
With this I will be able to get MyService's active descriptor and get "myMetadata" value.
Affected Versions
[2.2.0]
- Issue Imported From: https://github.com/javaee/hk2/issues/247
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @jwells131313
@glassfishrobot Commented Reported by @saden1
@glassfishrobot Commented This issue was imported from java.net JIRA HK2-203