jkwon
May 26th, 2005, 05:07 PM
Hi,
Here is my situation.
I want a particular set of methods on a variety of objects to first perform a check. If that check is passed, these methods should execute normally. If the check fails, method execution should not commence at all and we should just return to the caller.
This seems like a prime candidate for BeforeAdvice/MethodBeforeAdvice, except for one thing -- after execution of BeforeAdvice, the advised method would execute regardless of whether or not the check is passed.
I suppose I could have the BeforeAdvice throw an exception if the check fails, but this seems kind of like a hack to me. Plus, I'd rather not throw exceptions needlessly since they consume more stack space than what would be required if I could just get the MethodBeforeAdvice to cause the exiting of the advised method entirely.
Here is my situation.
I want a particular set of methods on a variety of objects to first perform a check. If that check is passed, these methods should execute normally. If the check fails, method execution should not commence at all and we should just return to the caller.
This seems like a prime candidate for BeforeAdvice/MethodBeforeAdvice, except for one thing -- after execution of BeforeAdvice, the advised method would execute regardless of whether or not the check is passed.
I suppose I could have the BeforeAdvice throw an exception if the check fails, but this seems kind of like a hack to me. Plus, I'd rather not throw exceptions needlessly since they consume more stack space than what would be required if I could just get the MethodBeforeAdvice to cause the exiting of the advised method entirely.