| /** |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| package org.netbeans.modules.db.metadata.model.api; |
| |
| import java.sql.Types; |
| |
| /** |
| * This is a type-safe enumeration wrapper around java.sql.Types |
| * |
| * @author David Van Couvering |
| */ |
| public enum SQLType { |
| // Fixed length types |
| BIT(Types.BIT), |
| TINYINT(Types.TINYINT), |
| SMALLINT(Types.SMALLINT), |
| INTEGER(Types.INTEGER), |
| BIGINT(Types.BIGINT), |
| FLOAT(Types.FLOAT), |
| REAL(Types.REAL), |
| DOUBLE(Types.DOUBLE), |
| NUMERIC(Types.NUMERIC), |
| DECIMAL(Types.DECIMAL), |
| CHAR(Types.CHAR), |
| DATE(Types.DATE), |
| TIME(Types.TIME), |
| TIMESTAMP(Types.TIMESTAMP), |
| NULL(Types.NULL), |
| OTHER(Types.OTHER), |
| JAVA_OBJECT(Types.JAVA_OBJECT), |
| DISTINCT(Types.DISTINCT), |
| REF(Types.REF), |
| DATALINK(Types.DATALINK), |
| BOOLEAN(Types.BOOLEAN), |
| VARCHAR(Types.VARCHAR), |
| LONGVARCHAR(Types.LONGVARCHAR), |
| BINARY(Types.BINARY), |
| VARBINARY(Types.VARBINARY), |
| LONGVARBINARY(Types.LONGVARBINARY), |
| STRUCT(Types.STRUCT), |
| ARRAY(Types.ARRAY), |
| BLOB(Types.BLOB), |
| CLOB(Types.CLOB), |
| // JDBC 4.0 |
| LONGNVARCHAR(-16), |
| NCHAR(-15), |
| NCLOB(2011), |
| NVARCHAR(-9), |
| SQLXML(2009), |
| ROWID(-8); |
| |
| private final int javasqltype; |
| |
| SQLType(int type) { |
| this.javasqltype = type; |
| } |
| |
| /** |
| * Get the java.sql.Type type specifier for the given SQLType |
| * |
| * @param type the SQLType type specifier |
| * @return the matching java.sql.Type type specifier |
| */ |
| public static int getJavaSQLType(SQLType type) { |
| return type.javasqltype; |
| } |
| } |