Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Use of wildcards in pointcut designators....

Hi,

I am still not very clear... 
Lets suppose that my class name is MyClass and I want
to match all the private and protected (not public
ones) methods of MyClass. So, how I will define a
pointcut then....

Well, I am using book "Mastering AspectJ" by Joseph
D.Gradecki and Nicholas Lesiecki for reference... and
it says (on page 62-63) that we can define pcd like:

call(* * DVD.*(*)) or
call(* void DVD.*(*)) or
call(* * *.*(*)).

But all of the above give compilation error...

Russell, you say that access types are enumeration so
is there any other way to match them, other than
specifying them in pcd...

Thanks in advance...
Swati


--- Russell Miles <russellmiles@xxxxxxx> wrote:

> Hi Swati,
> 
> First of all, what's the name of the class that the
> methods are on? 
> Also, you seem to be confusing wildcard behavior on
> the components of a 
> Signature (as the single parameter to a call pcd)
> with wildcards on a 
> String.
> 
> If, for example, the class that contained the
> methods was MyClass then 
> the following pcd should work to capture all three
> calls:
> 
> pointcut outputLog() : call(* MyClass.f*(..));
> 
> This doesn't treat the modifier as a string, rather
> an enumeration that 
> we simply are not interested in. Hope this helps :)
> 
> AspectJ is at 1.2 and is available for download from
> 
> www.eclipse.org/aspectj. This is the usual
> distribution with a compile 
> time weaver as well as some work done on load time
> weaving (see older 
> postings to this list for info on that).
> 
> Cheers,
> 
> Russ
> 
> 
> 
> On 29 Jul 2004, at 12:30, Swati Pradhan wrote:
> 
> > Hi everybody,
> >
> > I am new to AOSD... and there are few questions...
> >
> > I am trying some simple examples... and need some
> > clarification on the use of wildcard in the
> following
> > context:
> >
> > I have a java program with 3 functions:
> >     1) public int f1(int i);
> >
> >     2) private void f2();
> >
> >     3) protected int f3(int);
> >
> > If I declare a pointcut:
> >
> >     pointcut outputLog() : call(pr* * f*(..));
> >
> > for all the private and protected functions...
> >
> > both ajc 1.1.1 and 1.0.6 gives  compiler error:
> >
> >  expected "(", found f
> >  pointcut outputLog() : call(pr* * f*(..));
> >
> >
> > I am not clear: what's wrong with the pointcut
> format.
> > Can't we use wildcards for access type?... Can
> anyone
> > explain this to me ....
> >
> >
> > Please also let me know where I can find details
> of
> > how AspectJ is implemented.... (like how proceed()
> is
> > implemeted and why the particular implementation
> is
> > preffered to other alternatives)...
> >
> > One last question.... does AspectJ has a recent
> > version of Compile time weaver after Aspectj1.0.6.
> >
> > Thanks,
> > Swati
> >
> >
> >
> > 		
> > __________________________________
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - Send 10MB messages!
> > http://promotions.yahoo.com/new_mail
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> >
>
http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
>
http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail


Back to the top