On Thu, Mar 5, 2009 at 3:28 PM, Adam Winer <[email protected]> wrote:
> On Thu, Mar 5, 2009 at 3:23 PM, Jordan Zimmerman <[email protected]> wrote:
>> Adam - you wrote:
>>
>> "executeSocialRequest() is in the latest code on trunk:
>> Recommend overriding that instead of binding a custom pipeline."
>>
>> I have not found a way to do this with the current trunk as the
>> PreloadModule is hard-coded to PipelinedDataPreloader.
>> You also wrote:
>>
>> " (1) bind(PipelinedDataPreloader.class).to(YourSubclass.class) in your
>> own module. Yes, you can bind concrete classes to subclasses."
>>
>> I tried this and it didn't work. The constructor to PreloaderProvider()
>> still got PipelinedDataPreloader not my version. Are you certain this
>> works? Have you tried it yourself?
>
> Yes, many many times.  This really does work, and has to.  Try this:
>
> package org.apache.shindig.common;
>
> import com.google.inject.AbstractModule;
> import com.google.inject.Guice;
> import com.google.inject.Inject;
> import com.google.inject.Injector;
>
> public class QuickGuiceExample {
>  static public void main(String[] args) {
>    Injector injector = Guice.createInjector(new MyModule());
>    injector.getInstance(Target.class);
>  }
>
>  static class MyModule extends AbstractModule {
>    protected void configure() {
>      bind(Some.class).to(SomeOther.class);
>    }
>  }
>
>  static class Target {
>   �...@inject Target(Some some) {
>      System.out.println(some.getClass());
>    }
>  }
>  static class Some {}
>  static class SomeOther extends Some {}
> }
>
> It prints SomeOther.class.
>
>
>> " (2) Take advantage of the factored-apart DefaultGuiceModule, which is
>> now just:"
>>
>> It seems like really bad form to have to alter the Shindig source
>> directly. Isn't that the point of using DI?
>
> My point is that I've already altered the Shindig source.

... that is, by breaking apart DefaultGuiceModule, so you can largely
reuse all the pieces, just swapping out the modules that you don't
want.  That's the best that can be done with Guice 1.0.

>>
>>
>> Jordan Zimmerman
>> Principal Software Architect
>> 831.647.4712
>> 831.214.2990 (cell)
>> [email protected]
>>
>> SHOP*COMTM
>> Shop Smart, Save Big(tm)
>> www.shop.com
>>
>> This message (including any attachments) is intended only for
>> the use of the individual or entity to which it is addressed and
>> may contain information that is non-public, proprietary,
>> privileged, confidential, and exempt from disclosure under
>> applicable law or may constitute as attorney work product.
>> If you are not the intended recipient, you are hereby notified
>> that any use, dissemination, distribution, or copying of this
>> communication is strictly prohibited. If you have received this
>> communication in error, notify us immediately by telephone and
>> (i) destroy this message if a facsimile or (ii) delete this
>> message
>> immediately if this is an electronic communication.
>>
>> Thank you.
>>
>

Reply via email to