[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] can i inject class anottaion with aspectj ?

Thanks or the reply 
But I have problem here im trying to do aspect like this 
pointcut aspectTest ():
declare @type: *: @EntityListeners({SecurityListener.class});
and im getting this error 

Syntax error on tokens, declare [error | warning | parents | soft |
precedence] expected instead

What im doing wrong here ?  

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Sunday, December 02, 2007 1:42 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] can i inject class anottaion with aspectj ?

On 02/12/2007, Meir Yanovich <meiry@xxxxxxxxxxxx> wrote:
> So If I understand right I cant inject annotations in each class
> declaration.

do you mean cant? or do you mean can?

declare @type will attach an annotation to the type declaration

--- A.java ---
aspect A {
  declare @type: MyC*: @SomeAnnotation;
}

@interface SomeAnnotation {}

class MyC1 {}
class MyC2 {}
class MyC3 {}
--- End of A.java ---
ajc -1.5 -showWeaveInfo A.java
'MyC2' (A.java:8) is annotated with @SomeAnnotation type annotation
from 'A' (A.java:2)
'MyC3' (A.java:9) is annotated with @SomeAnnotation type annotation
from 'A' (A.java:2)
'MyC1' (A.java:7) is annotated with @SomeAnnotation type annotation
from 'A' (A.java:2)


declare @field/method/constructor will do the same for a member


> But only , types and methods correct me if I wrong
> Thanks for the fast reply

What else do you want to annotate?

Andy.

>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> Sent: Sunday, December 02, 2007 1:04 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] can i inject class anottaion with aspectj
?
>
> aspect X {
>   declare @type : org.xyz.model..* : @BusinessDomain ;
> }
>
> See declare annotation in the documentation:
>
>
http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-de
> clare.html
>
> Also, under https://bugs.eclipse.org/bugs/show_bug.cgi?id=86818 I am
> finishing support for something like this:
>
> declare @type: hasmethod(* someRandomMethod()): @SomeAnnotation;
>
> There is some basic support for this hasMember support in the codebase
> already (see that bug report) but it is not yet complete.
>
> Andy
>
> On 02/12/2007, Meir Yanovich <meiry@xxxxxxxxxxxx> wrote:
> > Hello all
> > I need to write annotation in every class I write , that is I need
to
> > insert annotations to something like 120 class
> > Can I inject it with aspectj ?
> > For example:
> > Every class have look like this :
> >
> >
> > @myAnnotation(some=value)
> > Public class A}
> > ...
> > ...
> > A(){}
> > ....
> > ..
> >
> >
> > {
> >
> > Can this annotation be injected to every of my class's?
> >
> > Thanks
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users