New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotation implementation builder #54
Comments
From crazyboblee on March 07, 2007 08:33:34 We could write an APT processor to generate implementations of all annotations |
From crazyboblee on March 07, 2007 18:48:16 Here's another generic method we could consider. It works if you know the attribute Example usage: The library method: public static <A extends Annotation> A bindingAnnotationOn(String fieldName) { I wish Java provided some language level meta programming support. It would be cool |
From limpbizkit on March 07, 2007 21:57:15 Yeah, it's kinda sad that we can do this: |
From kevinb9n on March 19, 2007 11:23:22 we should also simplify what's in the user's guide right away; they should not have Owner: kevinb9n |
From kevinb9n on April 29, 2007 11:41:45 this is less important since we're supporting Labels: -1.1 |
From kevinb9n on June 03, 2007 11:30:49 (No comment was entered for this change.) Status: WontFix |
From limpbizkit on March 07, 2007 03:46:26
In the user's guide, there's a lengthy section on how to implement an annotation for use with
annotatedWith(). See the java listing, "NamedAnnotation"
Why not provide a builder that creates objects with the appropriate equals, hashCode etc:
Named bob = new AnnotationBuilder<Named>(Named.class)
.set("value", "Bob")
.create();
It would be also possible to do an alternate form of the set() method that doesn't use Strings for
method names but it requires a ThreadLocal:
Named bob = new AnnotationBuilder<Named>(Named.class)
.set(fields(Named.class).value(), "Bob")
.create();
If you like the idea, I'd love to code it!
Original issue: http://code.google.com/p/google-guice/issues/detail?id=54
The text was updated successfully, but these errors were encountered: