Hi,
I was writing an aspect that intercepts apache commons
log calls and call corresponding method of my own logger instead. To
achieve this, I found it inconvenient to pointcut call of methods with same
parameter but different name. Shown as below:
pointcut logging_info(Object
message):
call(void
org.apache.commons.logging.Log.info(Object)) &&
args(message);
pointcut logging_warn(Object
message):
call(void
org.apache.commons.logging.Log.warn(Object)) &&
args(message);
void around(Object message) : logging_info(message)
{
mylog.log("info", message);
}
void around(Object message) : logging_warn(message)
{
mylog.log("warn", message);
}
As you can see, mylog can use method name of the one
intercepted by pointcut as its argument and do right things. However AFAIK
currently pointcut cannot bind method name to variables. So i think if we
can achieve this(including package/class/method name pattern), our
capabilities will be expanded.
PS: sorry for the incomplete mail a while ago, it's a
fat-finger mistake.