On Sat, 02 Nov 2013 20:31:10 -0200, Muhammad Gelbana <m.gelb...@gmail.com> wrote:

I may be wrong but I strongly don't think it's possible to use stereotype
annotations in Tapestry.

Stereotype annotations are annotations implying other annotations:
http://docs.oracle.com/javaee/7/tutorial/doc/cdi-adv008.htm#GKHQC

It's definitely a good improvement if it's supported by Tapestry IoC, don't you think ?

It would be an improvement, but I'm not sure it would be one large enough to be worth the time to implement it and the added complexity.

From the link above: "Stereotypes can be particularly useful in large applications where you have a number of beans that perform similar functions. A stereotype is a kind of annotation that specifies the following:"

* "A default scope"

In Tapestry-IoC, there are two scopes (singleton and perthread) that cover almost all situations. And I just didn't say 100% because you can add your own, even if, in my 6 years using Tapestry and subscribing to its users mailing lists, I can recall someone needing another scope.

* "Zero or more interceptor bindings"

In Tapestry-IoC, interceptors are implemented through advice or decoration, which are defined in module classes, so there's no such thing as interceptor bindings.

* "Optionally, a @Named annotation, guaranteeing default EL naming"

Tapestry-IoC nor Tapestry use EL. Every Tapestry-IoC has an unique bean/service id, even if you don't provide them explicitly, and a way to inject through them: @InjectService.

* Optionally, an @Alternative annotation, specifying that all beans with this stereotype are alternatives

Tapestry-IoC has marker annotations for what CDI calls alternatives.

In the end, with Tapestry-IoC, it's very rare to end up with a class, method or field containing more than one or two annotations (except for cases lie @Inject @Symbol(...) @Property private Something something), so the use of stereotype annotations would be very rare if implemented. In addition, I think it's confusing to have one annotation to actually mean other annotations.

By the way, have you ever seen the Tapestry-IoC's AnnotationProvider interface? It's used to provide access to annotations, for example, in MethodAdvice.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to