Class SqlStatement.MyDelegatingInvocationHandler

  • All Implemented Interfaces:
    java.lang.reflect.InvocationHandler
    Enclosing class:
    SqlStatement

    public static class SqlStatement.MyDelegatingInvocationHandler
    extends DelegatingInvocationHandler
    Reflectively implements the ResultSet interface by routing method calls to the result set inside a SqlStatement. When the result set is closed, so is the SqlStatement, and hence the JDBC connection and statement also.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Helper method to implement ResultSet.close().
      protected java.lang.Object getTarget()
      Returns the object to forward method calls to, should the derived class not implement the method.
      • Methods inherited from class java.lang.Object

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

      • MyDelegatingInvocationHandler

        MyDelegatingInvocationHandler​(SqlStatement sqlStatement)
        Creates a MyDelegatingInvocationHandler.
        Parameters:
        sqlStatement - SQL statement
    • Method Detail

      • getTarget

        protected java.lang.Object getTarget()
                                      throws java.lang.reflect.InvocationTargetException
        Description copied from class: DelegatingInvocationHandler
        Returns the object to forward method calls to, should the derived class not implement the method. Generally, this object will be a member of the derived class, supplied as a parameter to its constructor.

        The default implementation returns null, which will cause the DelegatingInvocationHandler.invoke(Object, java.lang.reflect.Method, Object[]) method to throw an UnsupportedOperationException if the derived class does not have the required method.

        Overrides:
        getTarget in class DelegatingInvocationHandler
        Returns:
        object to forward method calls to
        Throws:
        java.lang.reflect.InvocationTargetException - if there is an error acquiring the target
      • close

        public void close()
                   throws java.sql.SQLException
        Helper method to implement ResultSet.close().
        Throws:
        java.sql.SQLException - on error