Class 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 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
      • createConnection

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

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

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

        public Statement createStatement​(InvocationHandler handler)
        Creates a new proxy Statement 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 proxy
        handler - The handler that intercepts/overrides method calls.
        Returns:
        proxied object