[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] help on pointcuts weaving
|
- From: "Andy Clement" <andrew.clement@xxxxxxxxx>
- Date: Wed, 25 Jun 2008 08:34:40 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=SThfAKUbVibT5B9VhFA5YqjvEEics2xWvifMIEbyzEI=; b=pWQcTx3osYOW3U/33xLerDhRblmTicHvYVJeBOmi8/wlAnZK4IaMAC+5GegTefHLJw HKHSEeCXC6B1ZKDbKS6xzYBJu2AHc2mT3/OU+HTwqdp7UvloiDh+QQN3FLuUiy2CDNOx a1FdE2eiLwDgA+/gI+LVnZ2/iOy0YmfjlcBvk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=otCs64xMQ7eNB1PO+3y8rvz9anXK4Tw8ahPv0e2XR/ADKhdZsQ0mVadR22g5GQ3z3b UoQe/vJb5F4ZEm6U6XRyL6vVJ0iAAtVjSK36RV+TDeYpTPLKj0HzzEambvkC3Ry4NU+s LlT/sS1Jf88ZdVCtTCkTBfV3rPDK9os+bLPDM=
If your code is this:
public void foo() {
InetAddress testAddress = null;
Socket s = new Socket(addr, 80);
testAddress = s.getInetAddress().getLocalHost();
}
Your pointcut is this:
pointcut p(): call(* getLocalHost(..)) && withincode(public void foo());
The line s.getInetAddress().getLocalHost() contains multiple method
calls, a call to getInetAddress() and a call to getLocalHost() - you
can't use a single call() pointcut to match both of them. You want
the second one, so match the second one with your call().
Andy.
2008/6/25 Neeraja Maniyani <neeraja.maniyani@xxxxxxxxx>:
> hi,
>
> The call in the java class looks like this
>
> InetAddress testAddress = null;
> Socket s = new Socket(addr, 80);
> testAddress = s.getInetAddress().getLocalHost();
>
> I want the advice to weave in at this "s.getInetAddress().getLocalHost(); "
> point.
>
> The pointcut and advice with which i currently tested looks like this
>
> pointcut name2()
> : call(public * Socket.getInetAddress(..)) && withincode(public *
> InetAddress.getLocalHost(..));
>
>
> before() : name2() {
> System.out.println("able to weave"); }
>
>
> I have tested using this call(public * Socket.getInetAddress..*(..)).
>
> But the advice dint get weaved in
>
> thank you.
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>