tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
Subject Re: Service contributions via markers
Date Wed, 07 Jul 2010 00:30:53 GMT
On Tue, 06 Jul 2010 20:58:12 -0300, Howard Lewis Ship <hlship@gmail.com>  
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.

> 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

-- 
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: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message