KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > types > DTSClassInfo


1 /*
2
3    Derby - Class org.apache.derby.iapi.types.DTSClassInfo
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.types;
23
24 import org.apache.derby.iapi.services.io.StoredFormatIds;
25 import org.apache.derby.iapi.services.io.FormatableInstanceGetter;
26
27 public class DTSClassInfo extends FormatableInstanceGetter {
28
29         public Object JavaDoc getNewInstance() {
30             
31             
32                 // Does not handle StoredFormatIds.SQL_DECIMAL_ID as
33
// different implementations are required for different VMs.
34

35                 switch (fmtId) {
36                 /* Wrappers */
37                 case StoredFormatIds.SQL_BIT_ID: return new SQLBit();
38                 case StoredFormatIds.SQL_BOOLEAN_ID: return new SQLBoolean();
39                 case StoredFormatIds.SQL_CHAR_ID: return new SQLChar();
40                 case StoredFormatIds.SQL_DATE_ID: return new SQLDate();
41                 case StoredFormatIds.SQL_DOUBLE_ID: return new SQLDouble();
42                 case StoredFormatIds.SQL_INTEGER_ID: return new SQLInteger();
43                 case StoredFormatIds.SQL_LONGINT_ID: return new SQLLongint();
44                 case StoredFormatIds.SQL_NATIONAL_CHAR_ID: return new SQLNationalChar();
45                 case StoredFormatIds.SQL_NATIONAL_LONGVARCHAR_ID: return new SQLNationalLongvarchar();
46                 case StoredFormatIds.SQL_NATIONAL_VARCHAR_ID: return new SQLNationalVarchar();
47                 case StoredFormatIds.SQL_REAL_ID: return new SQLReal();
48                 case StoredFormatIds.SQL_REF_ID: return new SQLRef();
49                 case StoredFormatIds.SQL_SMALLINT_ID: return new SQLSmallint();
50                 case StoredFormatIds.SQL_TIME_ID: return new SQLTime();
51                 case StoredFormatIds.SQL_TIMESTAMP_ID: return new SQLTimestamp();
52                 case StoredFormatIds.SQL_TINYINT_ID: return new SQLTinyint();
53                 case StoredFormatIds.SQL_VARCHAR_ID: return new SQLVarchar();
54                 case StoredFormatIds.SQL_LONGVARCHAR_ID: return new SQLLongvarchar();
55                 case StoredFormatIds.SQL_VARBIT_ID: return new SQLVarbit();
56                 case StoredFormatIds.SQL_LONGVARBIT_ID: return new SQLLongVarbit();
57                 case StoredFormatIds.SQL_USERTYPE_ID_V3: return new UserType();
58                 case StoredFormatIds.SQL_BLOB_ID: return new SQLBlob();
59                 case StoredFormatIds.SQL_CLOB_ID: return new SQLClob();
60                 case StoredFormatIds.SQL_NCLOB_ID: return new SQLNClob();
61                 case StoredFormatIds.XML_ID: return new XML();
62
63                 /* Type ids */
64                 case StoredFormatIds.BIT_TYPE_ID:
65                 case StoredFormatIds.BOOLEAN_TYPE_ID:
66                 case StoredFormatIds.CHAR_TYPE_ID:
67                 case StoredFormatIds.DATE_TYPE_ID:
68                 case StoredFormatIds.DECIMAL_TYPE_ID:
69                 case StoredFormatIds.DOUBLE_TYPE_ID:
70                 case StoredFormatIds.INT_TYPE_ID:
71                 case StoredFormatIds.LONGINT_TYPE_ID:
72                 case StoredFormatIds.LONGVARBIT_TYPE_ID:
73                 case StoredFormatIds.LONGVARCHAR_TYPE_ID:
74                 case StoredFormatIds.NATIONAL_CHAR_TYPE_ID:
75                 case StoredFormatIds.NATIONAL_LONGVARCHAR_TYPE_ID:
76                 case StoredFormatIds.NATIONAL_VARCHAR_TYPE_ID:
77                 case StoredFormatIds.REAL_TYPE_ID:
78                 case StoredFormatIds.REF_TYPE_ID:
79                 case StoredFormatIds.SMALLINT_TYPE_ID:
80                 case StoredFormatIds.TIME_TYPE_ID:
81                 case StoredFormatIds.TIMESTAMP_TYPE_ID:
82                 case StoredFormatIds.TINYINT_TYPE_ID:
83                 case StoredFormatIds.USERDEFINED_TYPE_ID_V3:
84                 case StoredFormatIds.VARBIT_TYPE_ID:
85                 case StoredFormatIds.VARCHAR_TYPE_ID:
86                 case StoredFormatIds.BLOB_TYPE_ID:
87                 case StoredFormatIds.CLOB_TYPE_ID:
88                 case StoredFormatIds.NCLOB_TYPE_ID:
89                 case StoredFormatIds.XML_TYPE_ID:
90                         return new TypeId(fmtId);
91                 default:
92                         return null;
93                 }
94
95         }
96 }
97
Popular Tags