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.axion;
20:
21: import java.sql.Types;
22: import java.util.HashMap;
23: import java.util.Map;
24:
25: import org.netbeans.modules.sql.framework.codegen.AbstractTypeGenerator;
26: import org.netbeans.modules.sql.framework.codegen.DataType;
27:
28: /**
29: * Axion-specific type Generator.
30: *
31: * @author Ritesh Adval
32: * @author Ahimanikya Satapathy
33: * @version $Revision$
34: */
35: public class AxionTypeGenerator extends AbstractTypeGenerator {
36:
37: private static Map<Integer, DataType> supportedDataTypes;
38:
39: public Map createSupportedDataTypesMap() {
40: if (supportedDataTypes == null) {
41: supportedDataTypes = new HashMap<Integer, DataType>();
42:
43: supportedDataTypes
44: .put(new Integer(Types.BIT), DataType.BIT);
45:
46: supportedDataTypes.put(new Integer(Types.INTEGER),
47: DataType.INTEGER);
48: supportedDataTypes.put(new Integer(Types.SMALLINT),
49: DataType.INTEGER);
50: supportedDataTypes.put(new Integer(Types.TINYINT),
51: DataType.TINYINT);
52: supportedDataTypes.put(new Integer(Types.BIGINT),
53: DataType.BIGINT);
54:
55: supportedDataTypes.put(new Integer(Types.DECIMAL),
56: DataType.DECIMAL);
57: supportedDataTypes.put(new Integer(Types.DOUBLE),
58: DataType.DOUBLE);
59: supportedDataTypes.put(new Integer(Types.FLOAT),
60: DataType.FLOAT);
61: supportedDataTypes.put(new Integer(Types.NUMERIC),
62: DataType.NUMERIC);
63: supportedDataTypes.put(new Integer(Types.REAL),
64: DataType.DECIMAL);
65:
66: supportedDataTypes.put(new Integer(Types.DATE),
67: DataType.DATE);
68: supportedDataTypes.put(new Integer(Types.TIME),
69: DataType.TIME);
70: supportedDataTypes.put(new Integer(Types.TIMESTAMP),
71: DataType.TIMESTAMP);
72:
73: supportedDataTypes.put(new Integer(Types.CHAR),
74: DataType.CHAR);
75: supportedDataTypes.put(new Integer(Types.VARCHAR),
76: DataType.VARCHAR);
77: supportedDataTypes.put(new Integer(Types.LONGVARCHAR),
78: DataType.LONGVARCHAR);
79:
80: supportedDataTypes.put(new Integer(Types.BINARY),
81: DataType.BINARY);
82: supportedDataTypes.put(new Integer(Types.VARBINARY),
83: DataType.VARBINARY);
84: supportedDataTypes.put(new Integer(Types.LONGVARBINARY),
85: DataType.LONGVARBINARY);
86:
87: supportedDataTypes.put(new Integer(Types.JAVA_OBJECT),
88: DataType.JAVA_OBJECT);
89: supportedDataTypes.put(new Integer(Types.OTHER),
90: DataType.VARCHAR);
91:
92: supportedDataTypes.put(new Integer(Types.BLOB),
93: DataType.BLOB);
94: supportedDataTypes.put(new Integer(Types.CLOB),
95: DataType.CLOB);
96: }
97: return supportedDataTypes;
98: }
99: }
|