Package org.apache.commons.pool2.proxy
Class JdkProxySource<T>
- java.lang.Object
-
- org.apache.commons.pool2.proxy.JdkProxySource<T>
-
- Type Parameters:
T- type of the pooled object to be proxied
- All Implemented Interfaces:
ProxySource<T>
public class JdkProxySource<T> extends Object implements ProxySource<T>
Provides proxy objects using Java reflection.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description JdkProxySource(ClassLoader classLoader, Class<?>[] interfaces)Constructs a new proxy source for the given interfaces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TcreateProxy(T pooledObject, UsageTracking<T> usageTracking)Creates a new proxy object, wrapping the given pooled object.TresolveProxy(T proxy)Resolves the wrapped object from the given proxy.StringtoString()
-
-
-
Constructor Detail
-
JdkProxySource
public JdkProxySource(ClassLoader classLoader, Class<?>[] interfaces)
Constructs a new proxy source for the given interfaces.- Parameters:
classLoader- The class loader with which to create the proxyinterfaces- The interfaces to proxy
-
-
Method Detail
-
createProxy
public T createProxy(T pooledObject, UsageTracking<T> usageTracking)
Description copied from interface:ProxySourceCreates a new proxy object, wrapping the given pooled object.- Specified by:
createProxyin interfaceProxySource<T>- Parameters:
pooledObject- The object to wrapusageTracking- The instance, if any (usually the object pool) to be provided with usage tracking information for this wrapped object- Returns:
- the new proxy object
-
resolveProxy
public T resolveProxy(T proxy)
Description copied from interface:ProxySourceResolves the wrapped object from the given proxy.- Specified by:
resolveProxyin interfaceProxySource<T>- Parameters:
proxy- The proxy object- Returns:
- The pooled object wrapped by the given proxy
-
-