You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Muhammad Gelbana <m....@gmail.com> on 2013/11/02 23:31:10 UTC

Using stereotype annotations

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 ?

*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana

Re: Using stereotype annotations

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 06 Nov 2013 12:11:48 -0200, Muhammad Gelbana <m....@gmail.com>  
wrote:

> I can't currently think of an example. But there must be one.

What I can really think of an example now would be to treat one annotation  
as if it was another, so you can, for example, use an annotation you wrote  
inside your project, say, @MyTransactionalAnnotation, it treated like it  
was @CommitAfter automatically inside T-IoC. And, of course, we need to  
fix https://issues.apache.org/jira/browse/TAP5-2029 first. I'm on it, I  
know how it can implemented, but no ETA yet.

>
> *---------------------*
> *Muhammad Gelbana*
> http://www.linkedin.com/in/mgelbana
>
>
> On Mon, Nov 4, 2013 at 10:13 PM, Thiago H de Paula Figueiredo <
> thiagohp@gmail.com> wrote:
>
>> On Mon, 04 Nov 2013 17:49:05 -0200, Muhammad Gelbana  
>> <m....@gmail.com>
>> wrote:
>>
>>  What I understand out of this is that it's just a Java EE standard,  
>> that
>>> an annotation may imply other annotations. Personally I like the idea.
>>>
>>
>> Do you have any concrete examples for Tapestry or Tapestry-IoC in which  
>> we
>> would benefit of that?
>>
>>
>>  I've looked into the AnnotationProvider, thanks for the hint :)
>>>
>>
>> It may not be an eventual implementation, but it'll definetely be part  
>> of
>> that.
>>
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


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

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


Re: Using stereotype annotations

Posted by Muhammad Gelbana <m....@gmail.com>.
I can't currently think of an example. But there must be one.

*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana


On Mon, Nov 4, 2013 at 10:13 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Mon, 04 Nov 2013 17:49:05 -0200, Muhammad Gelbana <m....@gmail.com>
> wrote:
>
>  What I understand out of this is that it's just a Java EE standard, that
>> an annotation may imply other annotations. Personally I like the idea.
>>
>
> Do you have any concrete examples for Tapestry or Tapestry-IoC in which we
> would benefit of that?
>
>
>  I've looked into the AnnotationProvider, thanks for the hint :)
>>
>
> It may not be an eventual implementation, but it'll definetely be part of
> that.
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Using stereotype annotations

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 04 Nov 2013 17:49:05 -0200, Muhammad Gelbana <m....@gmail.com>  
wrote:

> What I understand out of this is that it's just a Java EE standard, that  
> an annotation may imply other annotations. Personally I like the idea.

Do you have any concrete examples for Tapestry or Tapestry-IoC in which we  
would benefit of that?

> I've looked into the AnnotationProvider, thanks for the hint :)

It may not be an eventual implementation, but it'll definetely be part of  
that.

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

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


Re: Using stereotype annotations

Posted by Muhammad Gelbana <m....@gmail.com>.
You have mentioned some standard usage for stereotype annotations but
Tapestry isn't obligated to use any of that. I even believe that the Java
documentation mentioned these usages just as examples, not an obligation
for what you use stereotype annotations.

What I understand out of this is that it's just a Java EE standard, that an
annotation may imply other annotations. Personally I like the idea.

I know Spring supports
it<http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/beans.html#beans-stereotype-annotations>,
and I don't like to see Tapestry fall back in front of any IoC during a
comparison.

I've looked into the AnnotationProvider, thanks for the hint :)

*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana


On Mon, Nov 4, 2013 at 3:39 AM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Sat, 02 Nov 2013 20:31:10 -0200, Muhammad Gelbana <m....@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Using stereotype annotations

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Sat, 02 Nov 2013 20:31:10 -0200, Muhammad Gelbana <m....@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org