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.core.BasicClass; 18 import org.as2lib.env.event.broadcaster.EventInfo; 19 20 /** 21 * {@code SimpleEventInfo} lets you dynamically set the name of the event. 22 * 23 * <p>Use this dynamic behavior only if it really adds any value. Creating a new 24 * {@code EventInfo} implementation that returns always the same name (immutable) 25 * for one specific listener is much cleaner. You then also only have to change the 26 * name of the event once in your {@code EventInfo} implementation if you change 27 * the event method name on the listener. 28 * 29 * @author Simon Wacker 30 */ 31 class org.as2lib.env.event.broadcaster.SimpleEventInfo extends BasicClass implements EventInfo { 32 33 /** Name of the event */ 34 private var eventName:String; 35 36 /** 37 * Constructs a {@code SimpleEventInfo} instance. 38 * 39 * @param name the name of the event 40 */ 41 public function SimpleEventInfo(eventName:String) { 42 this.eventName = eventName; 43 } 44 45 /** 46 * Returns the name of the event. 47 * 48 * @return the name of the event 49 */ 50 public function getName(Void):String { 51 return this.eventName; 52 } 53 54 }