org.jdbcdslog
Class ProxyUtils

java.lang.Object
  extended by org.jdbcdslog.ProxyUtils

public class ProxyUtils
extends Object

Author:
a511990

Constructor Summary
ProxyUtils()
           
 
Method Summary
static Class<?>[] findCompatibleInterfaces(Class<?> clazz, Class<?> requiredInterface)
          Find all interfaces of clazz that is-a requiredInterface.
static
<T> T
proxyForCompatibleInterfaces(Class<?> clazz, Class<T> requiredInterface, InvocationHandler invocationHandler)
          Find out all interfaces from clazz that is compatible with requiredInterface, and generate proxy base on that.
static Object wrap(LogMetaData logMetaData, Object r, Object... args)
          Convenient helper to wrap object base on its type.
static CallableStatement wrapByCallableStatementProxy(LogMetaData logMetaData, CallableStatement cs, String sql)
           
static Connection wrapByConnectionProxy(Connection c)
           
static Connection wrapByConnectionProxy(LogMetaData logMetaData, Connection c)
           
static Object wrapByConnectionSourceProxy(Object r, Class<?> interf)
           
static PooledConnection wrapByPooledConnection(PooledConnection con)
           
static PreparedStatement wrapByPreparedStatementProxy(LogMetaData logMetaData, PreparedStatement ps, String sql)
           
static ResultSet wrapByResultSetProxy(LogMetaData logMetaData, ResultSet r)
           
static Statement wrapByStatementProxy(LogMetaData logMetaData, Statement s)
           
static XAConnection wrapByXaConnection(XAConnection con)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyUtils

public ProxyUtils()
Method Detail

proxyForCompatibleInterfaces

public static <T> T proxyForCompatibleInterfaces(Class<?> clazz,
                                                 Class<T> requiredInterface,
                                                 InvocationHandler invocationHandler)
Find out all interfaces from clazz that is compatible with requiredInterface, and generate proxy base on that.

Parameters:
clazz -
requiredInterface -
invocationHandler -
Returns:

findCompatibleInterfaces

public static Class<?>[] findCompatibleInterfaces(Class<?> clazz,
                                                  Class<?> requiredInterface)
Find all interfaces of clazz that is-a requiredInterface.

Parameters:
clazz -
requiredInterface -
Returns:

wrapByStatementProxy

public static Statement wrapByStatementProxy(LogMetaData logMetaData,
                                             Statement s)

wrapByPreparedStatementProxy

public static PreparedStatement wrapByPreparedStatementProxy(LogMetaData logMetaData,
                                                             PreparedStatement ps,
                                                             String sql)

wrapByCallableStatementProxy

public static CallableStatement wrapByCallableStatementProxy(LogMetaData logMetaData,
                                                             CallableStatement cs,
                                                             String sql)

wrapByConnectionProxy

public static Connection wrapByConnectionProxy(Connection c)

wrapByConnectionProxy

public static Connection wrapByConnectionProxy(LogMetaData logMetaData,
                                               Connection c)

wrapByResultSetProxy

public static ResultSet wrapByResultSetProxy(LogMetaData logMetaData,
                                             ResultSet r)

wrapByXaConnection

public static XAConnection wrapByXaConnection(XAConnection con)

wrapByPooledConnection

public static PooledConnection wrapByPooledConnection(PooledConnection con)

wrapByConnectionSourceProxy

public static Object wrapByConnectionSourceProxy(Object r,
                                                 Class<?> interf)

wrap

public static Object wrap(LogMetaData logMetaData,
                          Object r,
                          Object... args)
Convenient helper to wrap object base on its type.

Parameters:
r -
args -
Returns:
Throws:
Exception


Copyright © 2015. All rights reserved.