Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Getting the name that matched c_* in call(* C+.f_*(..)) && cflow(call(t C+.c_*(..)));

Dear Friends,

It's great to be able to write patterns, but it seems like one ought
to be able to know what matched them in the bodies of related advice.
But I am struggling to understand how this is done.

Say, I have a pointcut like:

call(* Entity+.f_*(..)) && cflow(call(void Entity+.c_*(..)));

The code below uses thisJoinPoint to gets this, target and, the name
matching f_*.  How can I get the name matching c_*?  I want to be able
to call that method again later.  Are these things doable via
appropriate pointcut parameters?

public aspect constraint {
	pointcut fieldAccess() :
		call(* Entity+.f_*(..)) && cflow(call(void Entity+.c_*(..)));

	before() : fieldAccess() {
		System.out.println(thisJoinPoint.getSignature.getName());
		System.out.println(thisJoinPoint.getTarget());
		System.out.println(thisJoinPoint.getThis());
	}
}

Thanks a lot,

-- 
John M. Adams



Back to the top