glassfish-hk2 icon indicating copy to clipboard operation
glassfish-hk2 copied to clipboard

Ability to Add Arbitrary Metadata to Services via Annotation

Open glassfishrobot opened this issue 10 years ago • 3 comments

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]

glassfishrobot avatar Apr 24 '14 15:04 glassfishrobot

  • Issue Imported From: https://github.com/javaee/hk2/issues/247
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @jwells131313

glassfishrobot avatar Aug 30 '18 09:08 glassfishrobot

@glassfishrobot Commented Reported by @saden1

glassfishrobot avatar Apr 24 '14 15:04 glassfishrobot

@glassfishrobot Commented This issue was imported from java.net JIRA HK2-203

glassfishrobot avatar Apr 26 '17 10:04 glassfishrobot