001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.jdbc.metadata;
017
018import java.math.BigDecimal;
019import java.math.BigInteger;
020import java.sql.Time;
021import java.sql.Timestamp;
022import javax.lang.model.type.NullType;
023
024/**
025 * <p>
026 * This is a helper class used to obtain SQL type information for java types. The SQL type information is obtained from
027 * java.sql.Types class. The integers and strings returned by methods in this class are based on constants in java.sql.Types.
028 */
029
030public final class JDBCSQLTypeInfo {
031
032    // Prevent instantiation
033    private JDBCSQLTypeInfo() {
034    }
035
036    public static final class DefaultDataTypes {
037        public static final String STRING = "string"; //$NON-NLS-1$
038        public static final String BOOLEAN = "boolean"; //$NON-NLS-1$
039        public static final String BYTE = "byte"; //$NON-NLS-1$
040        public static final String SHORT = "short"; //$NON-NLS-1$
041        public static final String CHAR = "char"; //$NON-NLS-1$
042        public static final String INTEGER = "integer"; //$NON-NLS-1$
043        public static final String LONG = "long"; //$NON-NLS-1$
044        public static final String BIG_INTEGER = "biginteger"; //$NON-NLS-1$
045        public static final String FLOAT = "float"; //$NON-NLS-1$
046        public static final String DOUBLE = "double"; //$NON-NLS-1$
047        public static final String BIG_DECIMAL = "bigdecimal"; //$NON-NLS-1$
048        public static final String DATE = "date"; //$NON-NLS-1$
049        public static final String TIME = "time"; //$NON-NLS-1$
050        public static final String TIMESTAMP = "timestamp"; //$NON-NLS-1$
051        public static final String OBJECT = "object"; //$NON-NLS-1$
052        public static final String NULL = "null"; //$NON-NLS-1$
053        public static final String BLOB = "blob"; //$NON-NLS-1$
054        public static final String CLOB = "clob"; //$NON-NLS-1$
055        public static final String XML = "xml"; //$NON-NLS-1$
056    }
057
058    // java class names
059    public static final class DefaultDataClasses {
060        public static final Class<String> STRING = String.class;
061        public static final Class<Boolean> BOOLEAN = Boolean.class;
062        public static final Class<Byte> BYTE = Byte.class;
063        public static final Class<Short> SHORT = Short.class;
064        public static final Class<Character> CHAR = Character.class;
065        public static final Class<Integer> INTEGER = Integer.class;
066        public static final Class<Long> LONG = Long.class;
067        public static final Class<BigInteger> BIG_INTEGER = BigInteger.class;
068        public static final Class<Float> FLOAT = Float.class;
069        public static final Class<Double> DOUBLE = Double.class;
070        public static final Class<BigDecimal> BIG_DECIMAL = BigDecimal.class;
071        public static final Class<java.sql.Date> DATE = java.sql.Date.class;
072        public static final Class<Time> TIME = Time.class;
073        public static final Class<Timestamp> TIMESTAMP = Timestamp.class;
074        public static final Class<Object> OBJECT = Object.class;
075        public static final Class<NullType> NULL = NullType.class;
076    }
077
078}