01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19: package org.netbeans.modules.sql.framework.codegen.base;
20:
21: import java.sql.Types;
22: import java.util.HashMap;
23: import java.util.Map;
24: import org.netbeans.modules.sql.framework.codegen.AbstractTypeGenerator;
25: import org.netbeans.modules.sql.framework.codegen.DataType;
26:
27: /**
28: * @author Ritesh Adval
29: * @author Ahimanikya Satapathy
30: * @version $Revision$
31: */
32: public class BaseTypeGenerator extends AbstractTypeGenerator {
33:
34: public Map createSupportedDataTypesMap() {
35: HashMap<Integer, DataType> supportedDataTypes = new HashMap<Integer, DataType>();
36:
37: supportedDataTypes.put(new Integer(Types.BIT), DataType.BIT);
38: supportedDataTypes.put(new Integer(Types.BOOLEAN),
39: DataType.BOOLEAN);
40:
41: supportedDataTypes.put(new Integer(Types.BIGINT),
42: DataType.BIGINT);
43: supportedDataTypes.put(new Integer(Types.SMALLINT),
44: DataType.SMALLINT);
45: supportedDataTypes.put(new Integer(Types.TINYINT),
46: DataType.TINYINT);
47: supportedDataTypes.put(new Integer(Types.INTEGER),
48: DataType.INTEGER);
49:
50: supportedDataTypes.put(new Integer(Types.DECIMAL),
51: DataType.DECIMAL);
52: supportedDataTypes.put(new Integer(Types.DOUBLE),
53: DataType.DOUBLE_PRECISION);
54: supportedDataTypes
55: .put(new Integer(Types.FLOAT), DataType.FLOAT);
56: supportedDataTypes.put(new Integer(Types.NUMERIC),
57: DataType.NUMERIC);
58: supportedDataTypes.put(new Integer(Types.REAL), DataType.REAL);
59:
60: supportedDataTypes.put(new Integer(Types.DATE), DataType.DATE);
61: supportedDataTypes.put(new Integer(Types.TIME), DataType.TIME);
62: supportedDataTypes.put(new Integer(Types.TIMESTAMP),
63: DataType.TIMESTAMP);
64:
65: supportedDataTypes.put(new Integer(Types.CHAR), DataType.CHAR);
66: supportedDataTypes.put(new Integer(Types.LONGVARCHAR),
67: DataType.LONGVARCHAR);
68: supportedDataTypes.put(new Integer(Types.VARCHAR),
69: DataType.VARCHAR);
70:
71: supportedDataTypes.put(new Integer(Types.JAVA_OBJECT),
72: DataType.JAVA_OBJECT);
73: supportedDataTypes.put(new Integer(Types.OTHER),
74: DataType.VARCHAR);
75:
76: supportedDataTypes.put(new Integer(Types.BINARY),
77: DataType.BINARY);
78: supportedDataTypes.put(new Integer(Types.VARBINARY),
79: DataType.VARBINARY);
80: supportedDataTypes.put(new Integer(Types.LONGVARBINARY),
81: DataType.LONGVARBINARY);
82:
83: supportedDataTypes.put(new Integer(Types.BLOB), DataType.BLOB);
84: supportedDataTypes.put(new Integer(Types.CLOB), DataType.CLOB);
85: supportedDataTypes
86: .put(new Integer(Types.ARRAY), DataType.ARRAY);
87:
88: supportedDataTypes.put(new Integer(Types.DISTINCT),
89: DataType.DISTINCT);
90: supportedDataTypes.put(new Integer(Types.REF), DataType.REF);
91: supportedDataTypes.put(new Integer(Types.STRUCT),
92: DataType.STRUCT);
93: supportedDataTypes.put(new Integer(Types.DATALINK),
94: DataType.DATALINK);
95: supportedDataTypes.put(new Integer(Types.NULL), DataType.NULL);
96:
97: return supportedDataTypes;
98: }
99: }
|