1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.mozilla.org/MPL/MPL-1.1.html 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import org.as2lib.aop.JoinPoint; 18 import org.as2lib.aop.Advice; 19 20 /** 21 * {@code AroundAdvice} is invoked instead of a join point. The special thing about the 22 * around advice is that it can nevertheless proceed the join point if it likes to and 23 * can also change the arguments to use for the procession and alter the return type if 24 * wished. This means with the around advice you can change contextual information of 25 * the join point it is woven into. 26 * 27 * @author Simon Wacker 28 * @see <a href="http://www.simonwacker.com/blog/archives/000066.php">Advice</a> 29 */ 30 interface org.as2lib.aop.advice.AroundAdvice extends Advice { 31 32 /** 33 * Executes the actions to perform instead of the given {@code joinPoint}. If the 34 * {@code joinPoint} shall nevertheless be executed this has to be done manually 35 * by invoking the {@link JoinPoint#proceed} method. 36 * 37 * <p>The implementation of this method decides whether the actual join point is 38 * bypassed or if it is executed. It can also be decided what arguments to use for 39 * the procession and what to do with the response of the procession be it a return 40 * value or an exception. This means you can alter the context as you please. 41 * 42 * <p>If you use the proxy returned by the {@link AbstractAroundAdvice#getProxy} 43 * method to overwrite the actual join point, this method is executed instead of 44 * the join point and the result of this method is returned to the invoker of the 45 * join point. 46 * 47 * @param joinPoint the join point this advice was woven into 48 * @param args the arguments passed to the join point 49 * @return the result of the execution 50 */ 51 public function execute(joinPoint:JoinPoint, args:Array); 52 53 }