01: /*
02:
03: Derby - Class org.apache.derby.client.am.ParameterMetaData40
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (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;
25: import org.apache.derby.shared.common.reference.SQLState;
26:
27: public class ParameterMetaData40 extends ParameterMetaData {
28:
29: /**
30: *
31: * Calls the superclass constructor to pass the arguments
32: * @param columnMetaData ColumnMetaData
33: *
34: */
35: public ParameterMetaData40(ColumnMetaData columnMetaData) {
36: super (columnMetaData);
37: }
38:
39: /**
40: * Returns false unless <code>interfaces</code> is implemented
41: *
42: * @param interfaces a Class defining an interface.
43: * @return true if this implements the interface or
44: * directly or indirectly wraps an object
45: * that does.
46: * @throws java.sql.SQLException if an error occurs while determining
47: * whether this is a wrapper for an object
48: * with the given interface.
49: */
50: public boolean isWrapperFor(Class<?> interfaces)
51: throws SQLException {
52: return interfaces.isInstance(this );
53: }
54:
55: /**
56: * Returns <code>this</code> if this class implements the interface
57: *
58: * @param interfaces a Class defining an interface
59: * @return an object that implements the interface
60: * @throws java.sql.SQLExption if no object if found that implements the
61: * interface
62: */
63: public <T> T unwrap(java.lang.Class<T> interfaces)
64: throws SQLException {
65: try {
66: return interfaces.cast(this );
67: } catch (ClassCastException cce) {
68: throw new SqlException(null, new ClientMessageId(
69: SQLState.UNABLE_TO_UNWRAP), interfaces)
70: .getSQLException();
71: }
72: }
73: }
|