KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > am > ColumnMetaData40


1 /*
2
3    Derby - Class org.apache.derby.client.am.ColumnMetaData40
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.client.am;
23
24 import java.sql.SQLException JavaDoc;
25 import org.apache.derby.shared.common.reference.SQLState;
26
27 public class ColumnMetaData40 extends ColumnMetaData {
28     /**
29      * Calls the superclass constructor to pass the parameters
30      * @param logWriter LogWriter
31      */

32     public ColumnMetaData40(LogWriter logWriter) {
33         super(logWriter);
34     }
35
36     /**
37      * Calls the superclass constructor to pass the parameters
38      * @param logWriter LogWriter
39      * @param upperBound int
40      */

41     public ColumnMetaData40(LogWriter logWriter, int upperBound) {
42         super(logWriter,upperBound);
43     }
44     
45     /**
46      * Returns false unless <code>interfaces</code> is implemented
47      *
48      * @param interfaces a Class defining an interface.
49      * @return true if this implements the interface or
50      * directly or indirectly wraps an object
51      * that does.
52      * @throws java.sql.SQLException if an error occurs while determining
53      * whether this is a wrapper for an object
54      * with the given interface.
55      */

56     public boolean isWrapperFor(Class JavaDoc<?> interfaces) throws SQLException JavaDoc {
57         return interfaces.isInstance(this);
58     }
59     
60     /**
61      * Returns <code>this</code> if this class implements the interface
62      *
63      * @param interfaces a Class defining an interface
64      * @return an object that implements the interface
65      * @throws java.sql.SQLExption if no object if found that implements the
66      * interface
67      */

68     public <T> T unwrap(java.lang.Class JavaDoc<T> interfaces)
69                                    throws SQLException JavaDoc {
70         try {
71             return interfaces.cast(this);
72         } catch (ClassCastException JavaDoc cce) {
73             throw new SqlException(null,new ClientMessageId(SQLState.UNABLE_TO_UNWRAP),
74                     interfaces).getSQLException();
75         }
76     }
77 }
78
Popular Tags