1 23 package org.objectweb.jorm.naming.lib; 24 25 import org.objectweb.jorm.type.api.PType; 26 import org.objectweb.jorm.naming.api.PNameCoder; 27 28 34 public class CTHelper { 35 36 39 public static int ct2ptc(int ct) { 40 switch (ct) { 41 case PNameCoder.CTCHAR: 42 return PType.TYPECODE_CHAR; 43 case PNameCoder.CTOCHAR: 44 return PType.TYPECODE_OBJCHAR; 45 46 case PNameCoder.CTBYTE: 47 return PType.TYPECODE_BYTE; 48 case PNameCoder.CTOBYTE: 49 return PType.TYPECODE_OBJBYTE; 50 51 case PNameCoder.CTSHORT: 52 return PType.TYPECODE_SHORT; 53 case PNameCoder.CTOSHORT: 54 return PType.TYPECODE_OBJSHORT; 55 56 case PNameCoder.CTINT: 57 return PType.TYPECODE_INT; 58 case PNameCoder.CTOINT: 59 return PType.TYPECODE_OBJINT; 60 61 case PNameCoder.CTLONG: 62 return PType.TYPECODE_LONG; 63 case PNameCoder.CTOLONG: 64 return PType.TYPECODE_OBJLONG; 65 66 case PNameCoder.CTSTRING: 67 return PType.TYPECODE_STRING; 68 69 case PNameCoder.CTBYTEARRAY: 70 return PType.TYPECODE_BYTEARRAY; 71 case PNameCoder.CTCHARARRAY: 72 return PType.TYPECODE_CHARARRAY; 73 case PNameCoder.CTDATE: 74 return PType.TYPECODE_DATE; 75 case PNameCoder.CTBIGDECIMAL: 76 return PType.TYPECODE_BIGDECIMAL; 77 case PNameCoder.CTBIGINTEGER: 78 return PType.TYPECODE_BIGINTEGER; 79 default: 80 return -1; 81 } 82 } 83 84 87 public static int ptc2ct(int tpc) { 88 switch (tpc) { 89 case PType.TYPECODE_CHAR: 90 return PNameCoder.CTCHAR; 91 case PType.TYPECODE_OBJCHAR: 92 return PNameCoder.CTOCHAR; 93 94 case PType.TYPECODE_BYTE: 95 return PNameCoder.CTBYTE; 96 case PType.TYPECODE_OBJBYTE: 97 return PNameCoder.CTOBYTE; 98 99 case PType.TYPECODE_SHORT: 100 return PNameCoder.CTSHORT; 101 case PType.TYPECODE_OBJSHORT: 102 return PNameCoder.CTOSHORT; 103 104 case PType.TYPECODE_INT: 105 return PNameCoder.CTINT; 106 case PType.TYPECODE_OBJINT: 107 return PNameCoder.CTOINT; 108 109 case PType.TYPECODE_LONG: 110 return PNameCoder.CTLONG; 111 case PType.TYPECODE_OBJLONG: 112 return PNameCoder.CTOLONG; 113 114 case PType.TYPECODE_STRING: 115 return PNameCoder.CTSTRING; 116 117 case PType.TYPECODE_BYTEARRAY: 118 return PNameCoder.CTBYTEARRAY; 119 case PType.TYPECODE_CHARARRAY: 120 return PNameCoder.CTCHARARRAY; 121 case PType.TYPECODE_DATE: 122 return PNameCoder.CTDATE; 123 case PType.TYPECODE_BIGDECIMAL: 124 return PNameCoder.CTBIGDECIMAL; 125 case PType.TYPECODE_BIGINTEGER: 126 return PNameCoder.CTBIGINTEGER; 127 default: 128 return -1; 129 } 130 } 131 } 132 | Popular Tags |