+1 to James' implementation suggestion

-Adrian

On Wed, Aug 5, 2009 at 12:25 AM, James Strachan <[email protected]>wrote:

>
> 2009/8/5 Martin Lukasiewycz <[email protected]>:
> >
> > Hi Jesse,
> > I would wish a specific feature that is not listed in the "issues".
> > Its about a simplified binding of constants and somehow analog to the
> > @Provides feature.
> >
> > The common way to bind a constant:
> >
> > class MyModule extends AbstractModule {
> >
> >  public void configure(){
> >    bindConstant().annotatedWith(SomeBindingAnnotation.class).to
> > ("Hello, World!");
> >  }
> >
> > }
> >
> > The additional way i propose:
> >
> > class MyModule extends AbstractModule {
> >
> >  @SomeBindingAnnotation
> >  String myConstant = "Hello, World!";
> >
> >  ...
> >
> > }
>
> Nice idea - I like that. Maybe it should have a @Provides annotation
> too; so that @Provides can be used on methods or on fields?
>
> class MyModule extends AbstractModule {
>
>  @Provides
>  @SomeBindingAnnotation
>  String myConstant = "Hello, World!";
>
>  ...
>
> }
>
> which could be the field version of this?
>
> class MyModule extends AbstractModule {
>
>  @Provides
>  @SomeBindingAnnotation
>  public String myConstant() { return "Hello, World!" }
> }
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to