Class StatementDecoratorInterceptor.StatementProxy<T extends java.sql.Statement>

  • Type Parameters:
    T - The type of Statement being proxied.
    All Implemented Interfaces:
    java.lang.reflect.InvocationHandler
    Direct Known Subclasses:
    StatementCache.CachedStatement
    Enclosing class:
    StatementDecoratorInterceptor

    protected class StatementDecoratorInterceptor.StatementProxy<T extends java.sql.Statement>
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler
    Class to measure query execute time.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean closed
      Indicates whether this statement has been closed.
      protected T delegate
      The delegated statement.
    • Constructor Summary

      Constructors 
      Constructor Description
      StatementProxy​(T delegate, java.lang.String sql)
      Constructs a StatementProxy.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeInvoked()
      Called when the close method is invoked on the statement.
      java.lang.Object getActualProxy()
      Returns the actual proxy object.
      java.lang.Object getConnection()
      Returns the connection proxy.
      java.lang.reflect.Constructor<?> getConstructor()
      Returns the constructor used to create this proxy.
      T getDelegate()
      Returns the delegated statement.
      java.lang.String getSql()
      Returns the SQL text.
      java.lang.Object invoke​(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)  
      void setActualProxy​(java.lang.Object proxy)
      Sets the actual proxy object.
      void setConnection​(java.lang.Object proxy)
      Sets the connection proxy.
      void setConstructor​(java.lang.reflect.Constructor<?> constructor)
      Sets the constructor for creating proxies.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • closed

        protected boolean closed
        Indicates whether this statement has been closed.
      • delegate

        protected T extends java.sql.Statement delegate
        The delegated statement.
    • Constructor Detail

      • StatementProxy

        public StatementProxy​(T delegate,
                              java.lang.String sql)
        Constructs a StatementProxy.
        Parameters:
        delegate - the statement to delegate to
        sql - the SQL text
    • Method Detail

      • getDelegate

        public T getDelegate()
        Returns the delegated statement.
        Returns:
        the delegated statement
      • getSql

        public java.lang.String getSql()
        Returns the SQL text.
        Returns:
        the SQL text
      • setConnection

        public void setConnection​(java.lang.Object proxy)
        Sets the connection proxy.
        Parameters:
        proxy - the connection proxy
      • getConnection

        public java.lang.Object getConnection()
        Returns the connection proxy.
        Returns:
        the connection proxy
      • setActualProxy

        public void setActualProxy​(java.lang.Object proxy)
        Sets the actual proxy object.
        Parameters:
        proxy - the actual proxy
      • getActualProxy

        public java.lang.Object getActualProxy()
        Returns the actual proxy object.
        Returns:
        the actual proxy
      • getConstructor

        public java.lang.reflect.Constructor<?> getConstructor()
        Returns the constructor used to create this proxy.
        Returns:
        the constructor
      • setConstructor

        public void setConstructor​(java.lang.reflect.Constructor<?> constructor)
        Sets the constructor for creating proxies.
        Parameters:
        constructor - the constructor
      • closeInvoked

        public void closeInvoked()
        Called when the close method is invoked on the statement.
      • invoke

        public java.lang.Object invoke​(java.lang.Object proxy,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
        Specified by:
        invoke in interface java.lang.reflect.InvocationHandler
        Throws:
        java.lang.Throwable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object