Since: API Level 9
public interface

Wrapper

java.sql.Wrapper
Known Indirect Subclasses

Class Overview

This class is an actual usage of the wrapper pattern for JDBC classes. Developers can get the delegate instance when the instance may be a proxy class.

Summary

Public Methods
abstract boolean isWrapperFor(Class<?> iface)
If the caller is a wrapper of the class or implements the given interface, the methods return false and vice versa.
abstract <T> T unwrap(Class<T> iface)
Returns an object that implements the given interface.

Public Methods

public abstract boolean isWrapperFor (Class<?> iface)

Since: API Level 9

If the caller is a wrapper of the class or implements the given interface, the methods return false and vice versa.

Parameters
iface - the class that defines the interface
Returns
  • - true if the instance implements the interface
Throws
SQLException - when an error occurs when judges the object

public abstract T unwrap (Class<T> iface)

Since: API Level 9

Returns an object that implements the given interface. If the caller is not a wrapper, a SQLException will be thrown.

Parameters
iface - the class that defines the interface
Returns
  • - an object that implements the interface
Throws
SQLException - if there is no object implementing the specific interface