Class AbstractCreateStatementInterceptor

    • Field Detail

      • CREATE_STATEMENT

        protected static final java.lang.String CREATE_STATEMENT
        See Also:
        Constant Field Values
      • PREPARE_STATEMENT

        protected static final java.lang.String PREPARE_STATEMENT
        See Also:
        Constant Field Values
      • PREPARE_STATEMENT_IDX

        protected static final int PREPARE_STATEMENT_IDX
        See Also:
        Constant Field Values
      • STATEMENT_TYPES

        protected static final java.lang.String[] STATEMENT_TYPES
      • STATEMENT_TYPE_COUNT

        protected static final int STATEMENT_TYPE_COUNT
      • EXECUTE_TYPES

        protected static final java.lang.String[] EXECUTE_TYPES
      • constructors

        protected static final java.lang.reflect.Constructor<?>[] constructors
        the constructors that are used to create statement proxies
    • Constructor Detail

      • AbstractCreateStatementInterceptor

        public AbstractCreateStatementInterceptor()
    • Method Detail

      • invoke

        public java.lang.Object invoke​(java.lang.Object proxy,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
        Gets invoked each time an operation on Connection is invoked.
        Specified by:
        invoke in interface java.lang.reflect.InvocationHandler
        Overrides:
        invoke in class JdbcInterceptor
        Throws:
        java.lang.Throwable
      • getConstructor

        protected java.lang.reflect.Constructor<?> getConstructor​(int idx,
                                                                  java.lang.Class<?> clazz)
                                                           throws java.lang.NoSuchMethodException
        Creates a constructor for a proxy class, if one doesn't already exist
        Parameters:
        idx - - the index of the constructor
        clazz - - the interface that the proxy will implement
        Returns:
        - returns a constructor used to create new instances
        Throws:
        java.lang.NoSuchMethodException - Constructor not found
      • createStatement

        public abstract java.lang.Object createStatement​(java.lang.Object proxy,
                                                         java.lang.reflect.Method method,
                                                         java.lang.Object[] args,
                                                         java.lang.Object statement,
                                                         long time)
        This method will be invoked after a successful statement creation. This method can choose to return a wrapper around the statement or return the statement itself. If this method returns a wrapper then it should return a wrapper object that implements one of the following interfaces. Statement, PreparedStatement or CallableStatement
        Parameters:
        proxy - the actual proxy object
        method - the method that was called. It will be one of the methods defined in STATEMENT_TYPES
        args - the arguments to the method
        statement - the statement that the underlying connection created
        time - Elapsed time
        Returns:
        a Statement object
      • closeInvoked

        public abstract void closeInvoked()
        Method invoked when the operation Connection.close() is invoked.
      • isStatement

        protected boolean isStatement​(java.lang.reflect.Method method,
                                      boolean process)
        Returns true if the method that is being invoked matches one of the statement types.
        Parameters:
        method - the method being invoked on the proxy
        process - boolean result used for recursion
        Returns:
        returns true if the method name matched
      • isExecute

        protected boolean isExecute​(java.lang.reflect.Method method,
                                    boolean process)
        Returns true if the method that is being invoked matches one of the execute types.
        Parameters:
        method - the method being invoked on the proxy
        process - boolean result used for recursion
        Returns:
        returns true if the method name matched
      • process

        protected boolean process​(java.lang.String[] names,
                                  java.lang.reflect.Method method,
                                  boolean process)
      • reset

        public void reset​(ConnectionPool parent,
                          PooledConnection con)
        no-op for this interceptor. no state is stored.
        Specified by:
        reset in class JdbcInterceptor
        Parameters:
        parent - - the connection pool owning the connection
        con - - the pooled connection