Package org.apache.commons.dbutils
Class ProxyFactory
- java.lang.Object
-
- org.apache.commons.dbutils.ProxyFactory
-
public class ProxyFactory extends Object
Creates proxy implementations of JDBC interfaces. This avoids incompatibilities between the JDBC 2 and JDBC 3 interfaces. This class is thread safe.- See Also:
Proxy
,InvocationHandler
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProxyFactory()
Protected constructor for ProxyFactory subclasses to use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CallableStatement
createCallableStatement(InvocationHandler handler)
Creates a new proxyCallableStatement
object.Connection
createConnection(InvocationHandler handler)
Creates a new proxyConnection
object.Driver
createDriver(InvocationHandler handler)
Creates a new proxyDriver
object.PreparedStatement
createPreparedStatement(InvocationHandler handler)
Creates a new proxyPreparedStatement
object.ResultSet
createResultSet(InvocationHandler handler)
Creates a new proxyResultSet
object.ResultSetMetaData
createResultSetMetaData(InvocationHandler handler)
Creates a new proxyResultSetMetaData
object.Statement
createStatement(InvocationHandler handler)
Creates a new proxyStatement
object.static ProxyFactory
instance()
Returns the Singleton instance of this class.<T> T
newProxyInstance(Class<T> type, InvocationHandler handler)
Convenience method to generate a single-interface proxy using the handler's classloader
-
-
-
Constructor Detail
-
ProxyFactory
protected ProxyFactory()
Protected constructor for ProxyFactory subclasses to use.
-
-
Method Detail
-
instance
public static ProxyFactory instance()
Returns the Singleton instance of this class.- Returns:
- singleton instance
-
createCallableStatement
public CallableStatement createCallableStatement(InvocationHandler handler)
Creates a new proxyCallableStatement
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied CallableStatement
-
createConnection
public Connection createConnection(InvocationHandler handler)
Creates a new proxyConnection
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied Connection
-
createDriver
public Driver createDriver(InvocationHandler handler)
Creates a new proxyDriver
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied Driver
-
createPreparedStatement
public PreparedStatement createPreparedStatement(InvocationHandler handler)
Creates a new proxyPreparedStatement
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied PreparedStatement
-
createResultSet
public ResultSet createResultSet(InvocationHandler handler)
Creates a new proxyResultSet
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied ResultSet
-
createResultSetMetaData
public ResultSetMetaData createResultSetMetaData(InvocationHandler handler)
Creates a new proxyResultSetMetaData
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied ResultSetMetaData
-
createStatement
public Statement createStatement(InvocationHandler handler)
Creates a new proxyStatement
object.- Parameters:
handler
- The handler that intercepts/overrides method calls.- Returns:
- proxied Statement
-
newProxyInstance
public <T> T newProxyInstance(Class<T> type, InvocationHandler handler)
Convenience method to generate a single-interface proxy using the handler's classloader- Type Parameters:
T
- The type of object to proxy- Parameters:
type
- The type of object to proxyhandler
- The handler that intercepts/overrides method calls.- Returns:
- proxied object
-
-