1 16 17 21 22 package javax.jdo.listener; 23 24 import javax.jdo.spi.I18NHelper; 25 26 34 public class InstanceLifecycleEvent 35 extends java.util.EventObject { 36 37 private static final int FIRST_EVENT_TYPE = 0; 38 public static final int CREATE = 0; 39 public static final int LOAD = 1; 40 public static final int STORE = 2; 41 public static final int CLEAR = 3; 42 public static final int DELETE = 4; 43 public static final int DIRTY = 5; 44 public static final int DETACH = 6; 45 public static final int ATTACH = 7; 46 private static final int LAST_EVENT_TYPE = 7; 47 48 50 private final static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); 52 55 private final int eventType; 56 57 60 private final Object target; 61 62 69 public InstanceLifecycleEvent (Object source, int type) { 70 this(source, type, null); 71 } 72 73 81 public InstanceLifecycleEvent (Object source, int type, Object target) { 82 super (source); 83 if (type < FIRST_EVENT_TYPE || type > LAST_EVENT_TYPE) { 84 throw new IllegalArgumentException (msg.msg("EXC_IllegalEventType")); 85 } 86 eventType = type; 87 this.target = target; 88 } 89 90 95 public int getEventType () { 96 return eventType; 97 } 98 99 104 public Object getTarget () { 105 return target; 106 } 107 108 113 private void writeObject(java.io.ObjectOutputStream out) 114 throws java.io.IOException { 115 throw new java.io.NotSerializableException (); 116 } 117 } | Popular Tags |