0N/A/*
2362N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.sql;
0N/A
0N/A/**
0N/A * Interface for JDBC classes which provide the ability to retrieve the delegate instance when the instance
0N/A * in question is in fact a proxy class.
0N/A * <p>
0N/A * The wrapper pattern is employed by many JDBC driver implementations to provide extensions beyond
0N/A * the traditional JDBC API that are specific to a data source. Developers may wish to gain access to
0N/A * these resources that are wrapped (the delegates) as proxy class instances representing the
0N/A * the actual resources. This interface describes a standard mechanism to access
0N/A * these wrapped resources
0N/A * represented by their proxy, to permit direct access to the resource delegates.
0N/A *
0N/A * @since 1.6
0N/A */
0N/A
0N/Apublic interface Wrapper {
0N/A
0N/A /**
0N/A * Returns an object that implements the given interface to allow access to
0N/A * non-standard methods, or standard methods not exposed by the proxy.
0N/A *
0N/A * If the receiver implements the interface then the result is the receiver
0N/A * or a proxy for the receiver. If the receiver is a wrapper
0N/A * and the wrapped object implements the interface then the result is the
0N/A * wrapped object or a proxy for the wrapped object. Otherwise return the
0N/A * the result of calling <code>unwrap</code> recursively on the wrapped object
0N/A * or a proxy for that result. If the receiver is not a
0N/A * wrapper and does not implement the interface, then an <code>SQLException</code> is thrown.
0N/A *
0N/A * @param iface A Class defining an interface that the result must implement.
0N/A * @return an object that implements the interface. May be a proxy for the actual implementing object.
0N/A * @throws java.sql.SQLException If no object found that implements the interface
0N/A * @since 1.6
0N/A */
0N/A <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException;
0N/A
0N/A /**
0N/A * Returns true if this either implements the interface argument or is directly or indirectly a wrapper
0N/A * for an object that does. Returns false otherwise. If this implements the interface then return true,
0N/A * else if this is a wrapper then return the result of recursively calling <code>isWrapperFor</code> on the wrapped
0N/A * object. If this does not implement the interface and is not a wrapper, return false.
0N/A * This method should be implemented as a low-cost operation compared to <code>unwrap</code> so that
0N/A * callers can use this method to avoid expensive <code>unwrap</code> calls that may fail. If this method
0N/A * returns true then calling <code>unwrap</code> with the same argument should succeed.
0N/A *
0N/A * @param iface a Class defining an interface.
0N/A * @return true if this implements the interface or directly or indirectly wraps an object that does.
0N/A * @throws java.sql.SQLException if an error occurs while determining whether this is a wrapper
0N/A * for an object with the given interface.
0N/A * @since 1.6
0N/A */
0N/A boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException;
0N/A
0N/A}