biz.hammurapi.wrap
Class WrapperHandler
java.lang.Object
biz.hammurapi.wrap.WrapperHandler
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
- Direct Known Subclasses:
- StrongWrapperHandler, WeakWrapperHandler
public abstract class WrapperHandler
- extends java.lang.Object
- implements java.lang.reflect.InvocationHandler
Wraps Jsel object such as the underlying object becomes garbage collection
eligible and will be transparently restored from the database and source files
on demand
- Version:
- $Revision: 1.2 $
- Author:
- Pavel Vlasov
Field Summary |
protected java.util.Collection |
classesToWrap
Subclasses can add more classes to wrap. |
Method Summary |
static java.lang.Class[] |
getClassInterfaces(java.lang.Class sourceClass)
|
protected abstract java.lang.Object |
getMaster()
|
java.lang.Object |
getProxy()
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
static java.lang.Object |
wrap(java.lang.Object toWrap)
|
static java.lang.Object |
wrap(java.lang.Object toWrap,
java.util.Collection classesToWrap)
Convenience method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
classesToWrap
protected java.util.Collection classesToWrap
- Subclasses can add more classes to wrap.
WrapperHandler
public WrapperHandler(java.lang.Object master)
getProxy
public java.lang.Object getProxy()
invoke
public java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- Specified by:
invoke
in interface java.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
wrap
public static java.lang.Object wrap(java.lang.Object toWrap,
java.util.Collection classesToWrap)
throws java.lang.Throwable
- Convenience method.
- Parameters:
toWrap
- Object to wrapclassesToWrap
- collection of classes that shall be wrapped. Wrappable is always wrapped. Can be null.
- Returns:
- Proxy object for toWrap if toWrap is either Wrappable or instance of one of classes from classesToWrap,
toWrap otherwise
- Throws:
java.lang.Throwable
wrap
public static java.lang.Object wrap(java.lang.Object toWrap)
throws java.lang.Throwable
- Throws:
java.lang.Throwable
getMaster
protected abstract java.lang.Object getMaster()
throws java.lang.Throwable
- Throws:
java.lang.Throwable
getClassInterfaces
public static java.lang.Class[] getClassInterfaces(java.lang.Class sourceClass)
- Parameters:
sourceClass
-
- Returns:
- all interfaces implemented by this class
Copyright © 2003 Hammurapi Group. All Rights Reserved.