Thanks for the link, Aleksey.

Yeah, it seems like binding every configuration constant to an
instance a viable workaround for some situations, but it doesn't seem
like it's really the right solution.

In particular, on Android I don't want to load all of the resources at
the time the module is started.  Some of them can be memory intensive
(eg. bitmaps), and many of my Android activities will never use most
of them at all.

I can understand the arguments I've read elsewhere (eg. Dhanji here
http://bit.ly/1FPeAq ) that configuration data doesn't belong in code,
but every once in awhile we all have to work with frameworks that
force you to jump through hoops, and it seems like Guice could make
this sort of thing a lot easier with just a small tweak...

That being said, perhaps someone knows a way to do this already?  Is
it possible to get access to the Annotation instance from within a
provider?  I've been trying to follow the discussions here, but
haven't really been able to figure out what's supported and what
isn't.

http://code.google.com/p/google-guice/issues/detail?id=258
http://code.google.com/p/google-guice/issues/detail?id=27

Can I get this sort of capability with something like Guiceyfruit?
(And if so, can I use Guiceyfruit without AOP since AOP's not
supported on Android)

Cheers,
Mike





On Jul 22, 6:16 am, Aleksey Didik <[email protected]> wrote:
> Hello, I asked about this feature early.
>
> See 
> here:http://groups.google.com/group/google-guice/browse_frm/thread/1d61052...
>
> Best regards,
> Aleksey
>
> On Jul 21, 10:27 pm, Michael Burton <[email protected]> wrote:
>
>
>
> > Just thought I'd check in and see if anyone had any suggestions for
> > how to work around the following issue.
>
> > Cheers,
> > Mike
>
> > On Jul 17, 12:40 pm, Michael Burton <[email protected]> wrote:
>
> > > I would like to create a Provider that can provide a particular string
> > > based on the value of an Annotation.
>
> > > In particular (since I'm using Android), I would like to do something
> > > like the following:
>
> > > @Inject
> > > public void setString( @StringResource(R.string.foobar) String foobar)
> > > { ... }
>
> > > If you're not familiar with Android, R.string.foobar is an int value
> > > generated at compile time as part of the android build process.  It's
> > > a unique integer that you can use to call into a Resouce object in
> > > order to retrieve the corresponding String.
>
> > > I see some conversations in the google group from 2007 regarding
> > > various hacky ways to do this, and some suggestions that a less hacky
> > > way is imminent, but I don't see any actual solutions yet.
>
> > > Is there a way my provider can obtain the value of the resource in
> > > order to determine which String to inject?
>
> > > Cheers,
> > > Mike
>
> > > PS. 
> > > seehttp://groups.google.com/group/google-guice/browse_thread/thread/24f0...
> > > andhttp://code.google.com/p/google-guice/issues/detail?id=27for
> > > related conversations I've found so far.
--~--~---------~--~----~------------~-------~--~----~
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