Basically you need to be able to reference an instance of your annotation in
your binding.
You can do this by implementing your annotation:
class AnnotationNameImpl implements @AnnotationName {
....
}
and then you can instantiate an instance in your binding:
bind(...).annotatedWith(new AnnotationNameImpl(AnEnum.someValue));
I bet you could also develop a simple service that would allow you do do:
class YourModule {
....
@AnnotationName(AnEnum.someValue)
private static final String annotatedString = null;
protected void configure() {
Annotation annotation =
AnnotationReader.readAnnotationFrom(getClass(), "annotatedString");
bind(....)
}
}
-Fred
On Mon, Apr 19, 2010 at 11:44 AM, GuptaJi <[email protected]> wrote:
> Hi,
>
> I am relatively new to Guice but I have read the documentation well.
> I am looking for a way to create a map binder in my module with an
> annotation. Creating with an annotation is easy enough by supplying
> AnnotationName.class as the fourth parameter in newBinder(). My
> requirements need the annotation to be supplied with a value so that
> it is possible to use something like:
> @AnnotationName(AnEnum.someValue).
>
> Is it even possible to do something like what I am describing?
>
> Thanks a lot for your help.
>
> Cheers,
> GuptaJi
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-guice%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.