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.io.conn.core.event.MethodInvocationReturnInfo; 18 19 /** 20 * {@code MethodInvocationReturnListener} awaits a return value of a method invocation. 21 * 22 * <p>This interface can either be instantiated directly or implemented by a class. 23 * If you instantiate it directly you must overwrite the event method with an anonymous 24 * function. 25 * 26 * <p>Note that overwriting the event method with a anonymous function is error-prone, 27 * because the arguments' types and the return type are not type-checked. Instantiating 28 * an interface directly is also not permitted in Flex. 29 * 30 * <code> 31 * var listener:MethodInvocationReturnListener = new MethodInvocationReturnListener(); 32 * listener.onReturn = function(returnInfo:MethodInvocationReturnInfo):Void) { 33 * trace("Invoked method successfully: " + returnInfo); 34 * } 35 * </code> 36 * 37 * <p>Implementing the interface by a class is a much neater way. But sometimes it 38 * adds unnecessary complexity. 39 * 40 * <code> 41 * class MyListener implements MethodInvocationReturnListener { 42 * public function onReturn(returnInfo:MethodInvocationReturnInfo):Void { 43 * trace("Invoked method successfully: " + returnInfo); 44 * } 45 * } 46 * </code> 47 * 48 * @author Simon Wacker 49 */ 50 interface org.as2lib.io.conn.core.event.MethodInvocationReturnListener { 51 52 /** 53 * Is executed when the return value of the method invocation arrives. 54 * 55 * <p>This indicates that the method was invoked successfully. 56 * 57 * @param returnInfo contains the return value and some other useful information about 58 * the invoked method 59 */ 60 public function onReturn(returnInfo:MethodInvocationReturnInfo):Void; 61 62 }