View Javadoc

1   /*
2    * JBoss, Home of Professional Open Source.
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * 
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2.1 of the License, or (at your option) any later version.
11   * 
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   * 
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, write to the Free Software
19   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20   * 02110-1301 USA.
21   */
22  
23  package org.modeshape.jdbc.metadata;
24  
25  import java.math.BigDecimal;
26  import java.math.BigInteger;
27  import java.sql.Time;
28  import java.sql.Timestamp;
29  
30  import javax.lang.model.type.NullType;
31  
32  
33  /**
34   * <p> This is a helper class used to obtain SQL type information for java types.
35   * The SQL type information is obtained from java.sql.Types class. The integers and
36   * strings returned by methods in this class are based on constants in java.sql.Types.
37   */
38  
39  public final class JDBCSQLTypeInfo {
40  
41  
42      // Prevent instantiation
43      private JDBCSQLTypeInfo() {}
44          
45  	public static final class DefaultDataTypes {
46  		public static final String STRING = "string"; //$NON-NLS-1$
47  		public static final String BOOLEAN = "boolean"; //$NON-NLS-1$
48  		public static final String BYTE = "byte"; //$NON-NLS-1$
49  		public static final String SHORT = "short"; //$NON-NLS-1$
50  		public static final String CHAR = "char"; //$NON-NLS-1$
51  		public static final String INTEGER = "integer"; //$NON-NLS-1$
52  		public static final String LONG = "long"; //$NON-NLS-1$
53  		public static final String BIG_INTEGER = "biginteger"; //$NON-NLS-1$
54  		public static final String FLOAT = "float"; //$NON-NLS-1$
55  		public static final String DOUBLE = "double"; //$NON-NLS-1$
56  		public static final String BIG_DECIMAL = "bigdecimal"; //$NON-NLS-1$
57  		public static final String DATE = "date"; //$NON-NLS-1$
58  		public static final String TIME = "time"; //$NON-NLS-1$
59  		public static final String TIMESTAMP = "timestamp"; //$NON-NLS-1$
60  		public static final String OBJECT = "object"; //$NON-NLS-1$
61  		public static final String NULL = "null"; //$NON-NLS-1$
62  		public static final String BLOB = "blob"; //$NON-NLS-1$
63  		public static final String CLOB = "clob"; //$NON-NLS-1$
64  		public static final String XML = "xml"; //$NON-NLS-1$
65  	}
66      
67      //java class names
68  		public static final class DefaultDataClasses {
69  			public static final Class<String> STRING = String.class;
70  			public static final Class<Boolean> BOOLEAN = Boolean.class;
71  			public static final Class<Byte> BYTE = Byte.class;
72  			public static final Class<Short> SHORT = Short.class;
73  			public static final Class<Character> CHAR = Character.class;
74  			public static final Class<Integer> INTEGER = Integer.class;
75  			public static final Class<Long> LONG = Long.class;
76  			public static final Class<BigInteger> BIG_INTEGER = BigInteger.class;
77  			public static final Class<Float> FLOAT = Float.class;
78  			public static final Class<Double> DOUBLE = Double.class;
79  			public static final Class<BigDecimal> BIG_DECIMAL = BigDecimal.class;
80  			public static final Class<java.sql.Date> DATE = java.sql.Date.class;
81  			public static final Class<Time> TIME = Time.class;
82  			public static final Class<Timestamp> TIMESTAMP = Timestamp.class;
83  			public static final Class<Object> OBJECT = Object.class;
84  			public static final Class<NullType> NULL = NullType.class;
85  		}
86  
87  
88  }