1 package org.andromda.schema2xmi;
2
3 import java.lang.reflect.Field;
4 import java.sql.Types;
5 import java.util.HashMap;
6 import java.util.Map;
7
8
9
10
11
12
13
14
15
16 public class JdbcTypeFinder
17 {
18 private static final Map<Object, String> jdbcTypes = new HashMap<Object, String>();
19
20
21
22
23 static
24 {
25 try
26 {
27 Field[] fields = Types.class.getFields();
28 int fieldsNum = fields.length;
29 Field field;
30 for (int ctr = 0; ctr < fieldsNum; ctr++)
31 {
32 field = fields[ctr];
33 jdbcTypes.put(
34 field.get(null),
35 field.getName());
36 }
37 }
38 catch (Throwable th)
39 {
40 throw new SchemaTransformerException(th);
41 }
42 }
43
44
45
46
47
48
49
50
51
52 public static String find(int jdbcType)
53 {
54 return (String)jdbcTypes.get(jdbcType);
55 }
56 }