Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Help with pointcut on constructor for class with field of certain annotation

1.5.3 for sure, earlier 1.5.x versions might support it as well.

-Ramnivas

On 3/14/07, Pavel Kusch <sunpavlik@xxxxxxxxx > wrote:
Perfect. What version supports hasfield?

On 3/14/07, Ramnivas Laddad < ramnivas@xxxxxxxxxxxxxxx> wrote:
> This can be done using the experimental -XhasMember option to 'ajc' and then
> using hasfield() type pattern. Here is untested pointcut for your case:
>
> execution(* new(..)) && within(hasfield(@B * *))
>
> -Ramnivas
>
>
> On 3/14/07, Pavel Kusch <sunpavlik@xxxxxxxxx> wrote:
> >
> > Hello,
> >
> > Please how can I specify a pointcut that would match any constructor
> > of any class that has at least one instance varible of certain
> > annotation?
> >
> > For example if the annotation is @B then:
> >
> > class A {
> >   @B int field;
> >
> >    A() {}
> >    A(int a) {}
> > }
> > //matches both constructors
> >
> >
> > class A {
> >   int field;
> >
> >    A() {}
> >    A(int a) {}
> > }
> > //no match
> >
> > class A {
> >   @B int field1;
> >   @B int field2;
> >
> >    A() {}
> >    A(int a) {}
> > }
> > //matches both constructors
> >
> > Thank you,
> > Pavel Kusch
> > _______________________________________________
> > 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


Back to the top