[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Re routing calls
|
The advice looks like this now :
before() : CallToService ()
{
Method m = null;
logger.debug("Routing his call to the same class & method but with different parameters");
Object[] arguments = thisJoinPoint.getArgs();
Object[] extendedArguments = new Object[arguments.length+1];
System.arraycopy (arguments, 0, extendedArguments, 0, arguments.length);
extendedArguments[arguments.length] = Context.getCurrentProfile().getResponsability();
Object ourTarget = thisJoinPoint.getTarget();
SourceLocation sl = thisJoinPoint.getSourceLocation ();
try {
m = ourTarget.getClass()
.getMethod("", // Need to create the method name
ReflexionUtility.converter(extendedArguments));
... invoked the method by reflexion
} catch (java.lang.SecurityException e) {
logger.warn ("SecurityException");
} catch (NoSuchMethodException e) {
logger.warn ("NoSuchMethodException");
}
}
But I would like to find on the JoinPoint the name of the method to invoke. If possible not with
String matching...
\T,
Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.
Martin Fowler
T. : +32 (0)2 742 05 94
M. : +32 (0)497 44 68 12