KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > jdbc > EmbedParameterMetaData40


1 /*
2
3    Derby - Class org.apache.derby.impl.jdbc.EmbedParametertMetaData40
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.impl.jdbc;
23
24 import java.sql.SQLException JavaDoc;
25 import org.apache.derby.iapi.reference.SQLState;
26 import org.apache.derby.iapi.sql.ParameterValueSet;
27 import org.apache.derby.iapi.types.DataTypeDescriptor;
28
29 public class EmbedParameterMetaData40 extends EmbedParameterMetaData30 {
30     
31     /**
32      * Calls the superclass constructors with the parameters passed
33      *
34      * @param pvs ParameterValueSet pvs
35      * @param types DataTypeDescriptor
36      */

37     protected EmbedParameterMetaData40(ParameterValueSet pvs,
38                                           DataTypeDescriptor[] types) {
39             super(pvs,types);
40     }
41     
42     /**
43      * Returns false unless <code>interfaces</code> is implemented
44      *
45      * @param interfaces a Class defining an interface.
46      * @return true if this implements the interface or
47      * directly or indirectly wraps an object
48      * that does.
49      * @throws java.sql.SQLException if an error occurs while determining
50      * whether this is a wrapper for an object
51      * with the given interface.
52      */

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

65     public <T> T unwrap(java.lang.Class JavaDoc<T> interfaces)
66                             throws SQLException JavaDoc{
67         //Derby does not implement non-standard methods on
68
//JDBC objects
69
//hence return this if this class implements the interface
70
//or throw an SQLException
71
try {
72             return interfaces.cast(this);
73         } catch (ClassCastException JavaDoc cce) {
74             throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
75                     interfaces);
76         }
77     }
78 }
79
Popular Tags