Re: [picocontainer-dev] patches for *full* binding-annotation capability - key take aways & thoughts
Jörg Schaible <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Paul Hammant wrote:
> The style of binding annotations is like so -
>
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ElementType.FIELD, ElementType.PARAMETER}) @Bind
> public static @interface BindOne {}
>
> You'll make one of these per place where dis-ambiguation is needed.
> @Bind is marking this annotation as being one that can be used for
> dependency-injection binding (its in Pico's codebase, whereas BindOne
> will be in the customer's codebase)
>
> You can drop either of ElementType.FIELD or ElementType.PARAMETER
> depending on which flavor of DI you are doing.
>
> Unfortunately there's no way to do the much more terse (maybe in JDK
> 9.0) -
>
> public @interface BindOne extends Bind { }
>
> ---
>
> I've got binding annotations working for :
>
> * Constructor Injection
> * Setter Injection
> * Field Injection
> * Method Injection
>
> ---
>
> It has required changes to the PicoContainer interface :-
Without a closer look, but shouldn't "Class<? extends Annotation> binding" rather be "Class<? extends Bind> binding" ? End the end we handle arbitrary annotations only if they are derived from Bind ... or did I miss something?
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email