1 22 package org.jboss.invocation; 23 24 import java.io.Serializable ; 25 import java.io.ObjectStreamException ; 26 27 33 public final class InvocationType implements Serializable 34 { 35 36 private static final long serialVersionUID = 6460196085190851775L; 37 38 private static final String [] INTERFACE_NAMES = { "Remote", 39 "Local", "Home", "LocalHome", "ServiceEndpoint" 40 }; 41 42 46 private static final int MAX_TYPE_ID = 4; 47 48 49 private static final InvocationType[] values = new InvocationType[MAX_TYPE_ID+1]; 50 public static final InvocationType REMOTE = 51 new InvocationType("REMOTE", 0); 52 public static final InvocationType LOCAL = 53 new InvocationType("LOCAL", 1); 54 public static final InvocationType HOME = 55 new InvocationType("HOME", 2); 56 public static final InvocationType LOCALHOME = 57 new InvocationType("LOCALHOME", 3); 58 public static final InvocationType SERVICE_ENDPOINT = 59 new InvocationType("SERVICE_ENDPOINT", 4); 60 61 private final transient String name; 62 63 private final int ordinal; 65 66 private InvocationType(String name, int ordinal) 67 { 68 this.name = name; 69 this.ordinal = ordinal; 70 values[ordinal] = this; 71 } 72 73 public String toString() 74 { 75 return name; 76 } 77 81 public String toInterfaceString() 82 { 83 return INTERFACE_NAMES[ordinal]; 84 } 85 86 Object readResolve() throws ObjectStreamException 87 { 88 return values[ordinal]; 89 } 90 } 91 | Popular Tags |