Class ProxyFactory


  • public class ProxyFactory
    extends java.lang.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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static ProxyFactory instance
      The Singleton instance of this class.
    • 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
      java.sql.CallableStatement createCallableStatement​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy CallableStatement object.
      java.sql.Connection createConnection​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy Connection object.
      java.sql.Driver createDriver​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy Driver object.
      java.sql.PreparedStatement createPreparedStatement​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy PreparedStatement object.
      java.sql.ResultSet createResultSet​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy ResultSet object.
      java.sql.ResultSetMetaData createResultSetMetaData​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy ResultSetMetaData object.
      java.sql.Statement createStatement​(java.lang.reflect.InvocationHandler handler)
      Creates a new proxy Statement object.
      static ProxyFactory instance()
      Returns the Singleton instance of this class.
      <T> T newProxyInstance​(java.lang.Class<T> type, java.lang.reflect.InvocationHandler handler)
      Convenience method to generate a single-interface proxy using the handler's classloader
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • instance

        private static final ProxyFactory instance
        The Singleton instance of this class.
    • 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
      • newProxyInstance

        public <T> T newProxyInstance​(java.lang.Class<T> type,
                                      java.lang.reflect.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 proxy
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied object
      • createCallableStatement

        public java.sql.CallableStatement createCallableStatement​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy CallableStatement object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied CallableStatement
      • createConnection

        public java.sql.Connection createConnection​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy Connection object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied Connection
      • createDriver

        public java.sql.Driver createDriver​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy Driver object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied Driver
      • createPreparedStatement

        public java.sql.PreparedStatement createPreparedStatement​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy PreparedStatement object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied PreparedStatement
      • createResultSet

        public java.sql.ResultSet createResultSet​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy ResultSet object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied ResultSet
      • createResultSetMetaData

        public java.sql.ResultSetMetaData createResultSetMetaData​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy ResultSetMetaData object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied ResultSetMetaData
      • createStatement

        public java.sql.Statement createStatement​(java.lang.reflect.InvocationHandler handler)
        Creates a new proxy Statement object.
        Parameters:
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied Statement