tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: Service contributions via markers
Date Wed, 07 Jul 2010 17:51:46 GMT
Actually, I'm still struggling with something.

The current code compares the service def's markers against those
provided by the contribution def with equals(). I'm still struggling
with whether that should be containsAll(). I'm leaning towards
containsAll() even though that changes the results of a couple of
existing tests.

I think a fair statement is that a contribution method should be invoked if:
1) It matches the service interface of a service requesting a configuration
2) The service's marker annotations are a super-set of the
contribution methods marker annotations.

The second statement represents a tweak to the logic.

So if you have a service with marker @Blue @Red, then contribution
methods with no markers, or with markers @Blue, @Red, or @Blue @Red
would be invoked.

However a contribution method with @Green would not be invoked because
the service doesn't have the @Green marker.

On Wed, Jul 7, 2010 at 10:29 AM, Thiago H. de Paula Figueiredo
<thiagohp@gmail.com> wrote:
> On Wed, 07 Jul 2010 13:06:24 -0300, Howard Lewis Ship <hlship@gmail.com>
> wrote:
>
>> 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.
>
> Nice! It also helps for JSR 330 and 290 alignment and integration.
>
>>> 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.
>
> If we want to enforce something, let's enforce them as early as possible.
>
> --
> 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
>
>



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


Mime
View raw message