1 22 package org.jboss.ejb.plugins.cmp.jdbc.bridge; 23 24 import java.io.Serializable ; 25 import java.io.ObjectStreamException ; 26 27 35 public final class CMRMessage implements Serializable 36 { 37 private static int nextOrdinal = 0; 38 private static final CMRMessage[] VALUES = new CMRMessage[5]; 39 40 public static final CMRMessage GET_RELATED_ID = new CMRMessage("GET_RELATED_ID"); 41 public static final CMRMessage ADD_RELATION = new CMRMessage("ADD_RELATION"); 42 public static final CMRMessage REMOVE_RELATION = new CMRMessage("REMOVE_RELATION"); 43 public static final CMRMessage SCHEDULE_FOR_CASCADE_DELETE = new CMRMessage("CASCADE_DELETE"); 44 public static final CMRMessage SCHEDULE_FOR_BATCH_CASCADE_DELETE = new CMRMessage("BATCH_CASCADE_DELETE"); 45 46 47 private final transient String name; 48 private final int ordinal; 49 50 private CMRMessage(String name) 51 { 52 this.name = name; 53 this.ordinal = nextOrdinal++; 54 VALUES[ordinal] = this; 55 } 56 57 public String toString() 58 { 59 return name; 60 } 61 62 Object readResolve() throws ObjectStreamException 63 { 64 return VALUES[ordinal]; 65 } 66 67 } 68 69 70 | Popular Tags |