Re: [picocontainer-dev] patches for *full* binding-annotation capability - key take aways & thoughts

Paul Hammant <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
>
> It has required changes to the PicoContainer interface :-
>
> <pastedGraphic.tiff>

can y'all see tiffs ?

>
> Clearly there is some ugliness there - getComponentAdapter(s) has  
> two two-arg varients that in many of the test cases I've had to  
> please the compiler by casting null to ParameterName.
>
> it might be better to have a single signature for each -
>
>      <T> ComponentAdapter<T> getComponentAdapter(Class<T>  
> componentType, Object... bindingHint);
>
> - where binding hint could be a) missing, b) a ParameterName  
> instance or c) a binding annotation.  Unfortunately there's no  
> abstraction that can fit both and an Object varargs is hardly elegant.
>
> Alternate ideas -
>
>      <T> ComponentAdapter<T> getComponentAdapterWithBinding 
> (Class<T> componentType, Class<? extends Annotation> binding);
>      <T> T getComponentWithBinding(Class<T> componentType, Class<?  
> extends Annotation> binding);
>
>      <T> ComponentAdapter<T> getComponentAdapter(Key<T> key);
>      <T> T getComponent(Key<T> key);
>
>           - Key could be a wrapper for Class on its own, or Class &  
> binding annotation together.
>
> Or even a more fluent style - (usage example) -
>
>      Apple appleOne = mpc.forBoundAnnotation 
> (BindOne.class).getComponentAdapter(Apple.class);
>
> Which hints at a more fluent addComponent() styles -
>
>      mpc.addComponent(Apple.class, AppleImpl1.class).withBindingTo 
> (BindOne.class);
>
>      mpc.forBindingTo(BindOne.class).addComponent(Apple.class,  
> AppleImpl1.class);
>
>

All of these are particularly screaming for thought and comment  
(while I sleep)

- Paul

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.