On Tue, Jul 6, 2010 at 5:30 PM, Thiago H. de Paula Figueiredo
<[email protected]> wrote:
> On Tue, 06 Jul 2010 20:58:12 -0300, Howard Lewis Ship <[email protected]>
> wrote:
>
>> Actually, that's part of what I'm doing. You should use @Marker on the
>> service (i.e., on its service implementation class), but use the
>> annotations themselves on the contribute methods:
>>
>> @Marker(Red.class)
>> publlic class SomeServiceImpl extends SomeService { ...
>>
>> @Contribute(SomeService.class)
>> @Red @Blue
>> public void providePurple() {
>> // Contribute to services which have Color OR Blue
>> Where we are differing is on that last line: should providePurple() be
>> invoked for SomeServiceImpl (because it has the Red marker) or NOT
>> (because its missing the Blue marker)?
>
> No. This has the advantage of using the same rules for the dependency
> injection JSRs.

I am coding it up that way; the service must have all the markers
identified at the point-of-injection (i.e., on the contribution
method). This also brings it into alignment with how service injection
works.

>
>> Here's the trick: how do you know if an annotation is a marker
>> annotation or not (as opposed to any other kind of annotation,
>> including @Match or non-Tapestry specific ones)?
>
> JSR 330 uses an annotation (@Qualifier) in the annotation itself:
> http://atinject.googlecode.com/svn/trunk/javadoc/javax/inject/Qualifier.html

Ah, that would be simpler. Perhaps we should start enforcing that at
some point. As is, we can tell what the markers are by analyzing the
service definitions.

>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to