1 13 package info.magnolia.exchange; 14 15 19 public final class PacketType { 20 21 24 public static final int STRING = 1; 25 26 public static final int BINARY = 2; 27 28 public static final int LONG = 3; 29 30 public static final int DOUBLE = 4; 31 32 public static final int DATE = 5; 33 34 public static final int BOOLEAN = 6; 35 36 public static final int OBJECT = 7; 37 38 41 public static final String TYPENAME_STRING = "String"; 43 public static final String TYPENAME_BINARY = "Binary"; 45 public static final String TYPENAME_LONG = "Long"; 47 public static final String TYPENAME_DOUBLE = "Double"; 49 public static final String TYPENAME_DATE = "Date"; 51 public static final String TYPENAME_BOOLEAN = "Boolean"; 53 public static final String TYPENAME_OBJECT = "Object"; 55 58 private PacketType() { 59 } 61 62 66 public static String getNameByType(int type) { 67 switch (type) { 68 case STRING: 69 return TYPENAME_STRING; 70 case BINARY: 71 return TYPENAME_BINARY; 72 case BOOLEAN: 73 return TYPENAME_BOOLEAN; 74 case LONG: 75 return TYPENAME_LONG; 76 case DOUBLE: 77 return TYPENAME_DOUBLE; 78 case DATE: 79 return TYPENAME_DATE; 80 case OBJECT: 81 return TYPENAME_OBJECT; 82 default: 83 throw new IllegalArgumentException ("unknown type: " + type); } 85 } 86 } 87 | Popular Tags |