You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
Is it possible to retrieve an object with a specific annotation.
Example:
@ExtensionId(value=123) class Test { }
@ExtensionId(value=124)
class Test2 {
}
Object obj = injector.getInstance(???); // retrieve the object with the @ExtensionId(value=123) Object obj = injector.getInstance(???); // retrieve the object with the @ExtensionId(value=124)
That would allow me to use the extension-id in an Eclipse RCP app to retrieve a specifc UI object in a Factory class.
Regards Roger
Regards Roger
Thomas Broyer
unread,
May 25, 2012, 9:09:32 AM5/25/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
1. create a class (say ExtensionIdImpl) that implements the ExtensionId interface (have a look at Names.named() source code in Guice); make sure you follow the contract for Annotation#equals()
2. use injector.getInstance(Key.get(Test.class, new ExtensionIdImpl(123)));