I ant to build an Aspect for checking input parameters for all methods thats use String type input parameter.
The method can continue if only the input parameter is not null or undefined and string.length>0.
So I decide to write an new Aspect.
But How can i overwriting the args parameters when i do my : joinPoint.proceed(args) ?
There is an exemple of my Aspect Method :
private function checkStringAdvice(joinPoint:JoinPoint, args:FunctionArguments) {
var s:String = args[0];
if(s != undefined && s.length >0) {
joinPoint.proceed(args);
}else {
joinPoint.proceed(["a base string"]); //Not work !!
}
}
thanks for help ;)
@+
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But we have to set the TYPE_AROUND mode for Addvice interception....otherwise it doesn't work...
In TYPE_BEFORE = the old value is passed
in TYPE_AFTER = undefined value is passed...
So great, thanks a lot ;)
If I understand your mail, I must use the mailing list (as2lib-updates) rather than the sf forum, for quick technical support ? Okay I do..
Thank you and cheer for this formidable project ;)
eRom
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I ant to build an Aspect for checking input parameters for all methods thats use String type input parameter.
The method can continue if only the input parameter is not null or undefined and string.length>0.
So I decide to write an new Aspect.
But How can i overwriting the args parameters when i do my : joinPoint.proceed(args) ?
There is an exemple of my Aspect Method :
private function checkStringAdvice(joinPoint:JoinPoint, args:FunctionArguments) {
var s:String = args[0];
if(s != undefined && s.length >0) {
joinPoint.proceed(args);
}else {
joinPoint.proceed(["a base string"]); //Not work !!
}
}
thanks for help ;)
@+
joinPoint.proceed(["a base string"]); should work trouble-free in case you did all the rest the right way.
Okay, indeed all works well ;)
But we have to set the TYPE_AROUND mode for Addvice interception....otherwise it doesn't work...
In TYPE_BEFORE = the old value is passed
in TYPE_AFTER = undefined value is passed...
So great, thanks a lot ;)
If I understand your mail, I must use the mailing list (as2lib-updates) rather than the sf forum, for quick technical support ? Okay I do..
Thank you and cheer for this formidable project ;)
eRom
Yep, JoinPoint proceed can only be used with Around Advices.
The Before Advice executes the method itself, as well as the After Advice.