Package org.coliper.ibean.proxy.handler
Class StatefulExtensionHandler
- java.lang.Object
-
- org.coliper.ibean.proxy.handler.StatefulExtensionHandler
-
- All Implemented Interfaces:
ExtensionHandler
- Direct Known Subclasses:
FreezableHandler,LazyInitHandler,ModificationAwareHandler
public abstract class StatefulExtensionHandler extends Object implements ExtensionHandler
/** Abstract base class forExtensionHandlerimplementations that need to maintain their own state. Concrete implementations can choose with of the default implementations ofhandleExtendedInterfaceCall(IBeanContext, IBeanFieldAccess, Object, Method, Object[]),ExtensionHandler.interceptGetterCall(IBeanContext, IBeanFieldMetaInfo, Object, Object)andExtensionHandler.interceptSetterCall(IBeanContext, IBeanFieldMetaInfo, Object, Object)to override.For stateful handlers it is recommendable if the handler itself implements the extension interface. This class' implementation of
handleExtendedInterfaceCall(IBeanContext, IBeanFieldAccess, Object, Method, Object[])does simply forwards any extension interface call to the bean to associated handler instance.
-
-
Constructor Summary
Constructors Constructor Description StatefulExtensionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjecthandleExtendedInterfaceCall(IBeanContext<?> context, IBeanFieldAccess bean, Object proxyInstance, Method method, Object[] params)This default implementation re-calls the interface method onto the handler itself assuming the handler implements the extension interface as well.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.coliper.ibean.proxy.ExtensionHandler
interceptGetterCall, interceptSetterCall, onInitStateful
-
-
-
-
Method Detail
-
handleExtendedInterfaceCall
public Object handleExtendedInterfaceCall(IBeanContext<?> context, IBeanFieldAccess bean, Object proxyInstance, Method method, Object[] params) throws Throwable
This default implementation re-calls the interface method onto the handler itself assuming the handler implements the extension interface as well.- Specified by:
handleExtendedInterfaceCallin interfaceExtensionHandler- Parameters:
context- provides meta information about the beanbean- allows this method to read or change field values of the IBeanproxyInstance- the IBean instance object (seeInvocationHandler.invoke(Object, Method, Object[])for more details)method- theMethodof the extension interface that was called on the IBean (seeInvocationHandler.invoke(Object, Method, Object[])for more details)params- the parameters passed to the extension method call (seeInvocationHandler.invoke(Object, Method, Object[])for more details)- Returns:
- an object that matches to the return type of the extension
method; return
nullif the return type isvoid. (seeInvocationHandler.invoke(Object, Method, Object[])for more details) - Throws:
Throwable- can be anyError,RuntimeExceptionor checked exception that is definied in the signature of the extension method. (seeInvocationHandler.invoke(Object, Method, Object[])for more details)- See Also:
ExtensionHandler.handleExtendedInterfaceCall(IBeanContext, IBeanFieldAccess, Object, Method, Object[])
-
-