Hi,

Am 19.03.2014 18:37, schrieb Mike Grove:
> On Wed, Mar 19, 2014 at 1:32 PM, Philipp Wendler 
> <[email protected]>wrote:
>> Am 19.03.2014 17:20, schrieb Mike Grove:
>>> I'd like to have some default implementation of an interface, and then
>> in a
>>> separate module, provide a new implementation which uses the old one, via
>>> the decorator pattern.  And everywhere that should have gotten the
>> default,
>>> gets the overridden one, and the modified behavior.
>>
>> I had the same problem, and developed a solution that I described here:
>> http://stackoverflow.com/q/7416974/396730
> 
> 
> Looks promising.  Is the source for your annotation & utilities available
> anywhere?

So far no.
I ended up not using it for other reasons, and so I never added tests
etc. and made it available online. I could do so, but it would need some
time I guess.

If you have a hard-coded chain of decorators, you could probably leave
out the most complicated part (which is the overriding of bindings) and
just declare the bindings by hand:
A.class annotatedWith(InInstance(B.class)) to A.class
A.class to B.class

Maybe you need to use a common interface for A and B that is used as the
actual binding, not sure if the above works directly. With an interface
it looks like this:
I.class annotatedWith(InInstance(B.class)) to A.class
I.class to B.class

The InInstance annotation does not contain anything big, it is just a
regular annotation (you can take a look at the implementation of Named).

Greetings,
Philipp

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/d/optout.

Reply via email to