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(Object r, Object... args)
          Convenient helper to wrap object base on its type.
static CallableStatement wrapByCallableStatementProxy(Object r, String sql)
           
static Connection wrapByConnectionProxy(Object r)
           
static Object wrapByConnectionSourceProxy(Object r, Class<?> interf)
           
static PooledConnection wrapByPooledConnection(PooledConnection con)
           
static PreparedStatement wrapByPreparedStatementProxy(Object r, String sql)
           
static ResultSet wrapByResultSetProxy(ResultSet r)
           
static Statement wrapByStatementProxy(Object r)
           
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(Object r)

wrapByPreparedStatementProxy

public static PreparedStatement wrapByPreparedStatementProxy(Object r,
                                                             String sql)

wrapByCallableStatementProxy

public static CallableStatement wrapByCallableStatementProxy(Object r,
                                                             String sql)

wrapByConnectionProxy

public static Connection wrapByConnectionProxy(Object r)

wrapByResultSetProxy

public static ResultSet wrapByResultSetProxy(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(Object r,
                          Object... args)
Convenient helper to wrap object base on its type.

Parameters:
r -
args -
Returns:
Throws:
Exception


Copyright © 2014. All rights reserved.