1 48 package org.exolab.jms.events; 49 50 import java.io.Serializable ; 51 52 53 71 public class Event 72 implements Serializable { 73 74 77 private int _eventType; 78 79 83 private EventHandler _eventHandler = null; 84 85 89 private Object _callbackObject = null; 90 91 92 102 public Event(int event, EventHandler listener, Object callback) 103 throws IllegalEventDefinedException { 104 if ((event != 0) && 105 (listener != null)) { 106 _eventType = event; 107 _eventHandler = listener; 108 109 if (callback != null) { 113 if (callback instanceof Serializable ) { 114 _callbackObject = callback; 115 } else { 116 throw new IllegalEventDefinedException( 117 "The callback object is not Serializable"); 118 } 119 } 120 } else { 121 throw new IllegalEventDefinedException( 123 "event is 0 or listener is null"); 124 } 125 } 126 127 132 public int getEventType() { 133 return _eventType; 134 } 135 136 141 public EventHandler getEventListener() { 142 return _eventHandler; 143 } 144 145 151 public Object getCallbackObject() { 152 return _callbackObject; 153 } 154 } 155 156 157 | Popular Tags |