1
|
package deserialize;
|
2
|
|
3
|
import java.util.HashMap;
|
4
|
|
5
|
public class DataType {
|
6
|
|
7
|
public final static HashMap<Character, String> primTypeCodes;
|
8
|
public final static HashMap<Character, String> objTypeCodes;
|
9
|
|
10
|
static {
|
11
|
primTypeCodes = new HashMap<Character, String>();
|
12
|
primTypeCodes.put('B', "byte");
|
13
|
primTypeCodes.put('C', "char");
|
14
|
primTypeCodes.put('D', "double");
|
15
|
primTypeCodes.put('F', "float");
|
16
|
primTypeCodes.put('I', "integer");
|
17
|
primTypeCodes.put('J', "long");
|
18
|
primTypeCodes.put('S', "short");
|
19
|
primTypeCodes.put('Z', "boolean");
|
20
|
|
21
|
objTypeCodes = new HashMap<Character, String>();
|
22
|
objTypeCodes.put('[', "array");
|
23
|
objTypeCodes.put('L', "object");
|
24
|
}
|
25
|
|
26
|
public static boolean isPrimaryType(char type) {
|
27
|
return primTypeCodes.containsKey(type);
|
28
|
}
|
29
|
|
30
|
}
|