Package org.logicalcobwebs.proxool
Class WrappedConnection
- java.lang.Object
-
- org.logicalcobwebs.proxool.WrappedConnection
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
,net.sf.cglib.proxy.Callback
,net.sf.cglib.proxy.MethodInterceptor
public class WrappedConnection extends java.lang.Object implements net.sf.cglib.proxy.MethodInterceptor, java.lang.reflect.InvocationHandler
Wraps up aProxyConnection
. It is proxied as aConnection
- Since:
- Proxool 0.9
- Version:
- $Revision: 1.6 $, $Date: 2006/01/18 14:40:02 $
- Author:
- Bill Horsman, $Author: billhorsman $ (current maintainer)
-
-
Constructor Summary
Constructors Constructor Description WrappedConnection(ProxyConnection proxyConnection)
Construct this wrapper around the proxy connection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
If the object passed to this method is actually a proxied version of this class then compare the real class with this one.java.lang.String
getAlias()
Get the alias of the connection pool this connection belongs tolong
getId()
The ID for the encapsulatedProxyConnection
.ProxyConnection
getProxyConnection()
Get the encapsulated proxy connectionjava.lang.Object
intercept(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy proxy)
Delegates toinvoke
java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
Delegates all operations to the encapsulatedProxyConnection
except for: close() equals() hashCode() isClosed() getMetaData() finalize() It also spots mutators and remembers that the property has been changed so that it can bereset
.java.lang.String
toString()
-
-
-
Constructor Detail
-
WrappedConnection
public WrappedConnection(ProxyConnection proxyConnection)
Construct this wrapper around the proxy connection- Parameters:
proxyConnection
- to wrap
-
-
Method Detail
-
getProxyConnection
public ProxyConnection getProxyConnection()
Get the encapsulated proxy connection- Returns:
- the proxy connection
-
intercept
public java.lang.Object intercept(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, net.sf.cglib.proxy.MethodProxy proxy) throws java.lang.Throwable
Delegates toinvoke
- Specified by:
intercept
in interfacenet.sf.cglib.proxy.MethodInterceptor
- Throws:
java.lang.Throwable
- See Also:
MethodInterceptor.intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], org.logicalcobwebs.cglib.proxy.MethodProxy)
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
Delegates all operations to the encapsulatedProxyConnection
except for:- close()
- equals()
- hashCode()
- isClosed()
- getMetaData()
- finalize()
reset
. And any statements that are returned are remembered so that we can track whether all statements have been closed properly when the connection is returned to the pool.- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
- See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
-
getId
public long getId()
The ID for the encapsulatedProxyConnection
. This will still return the correct value after the connection is closed.- Returns:
- the ID
-
getAlias
public java.lang.String getAlias()
Get the alias of the connection pool this connection belongs to- Returns:
alias
-
equals
public boolean equals(java.lang.Object obj)
If the object passed to this method is actually a proxied version of this class then compare the real class with this one.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to compare- Returns:
- true if the object is a proxy of "this"
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-