public class LazyInitHandler extends StatefulExtensionHandler
ExtensionHandler implementation for bean extension interfaces
LazyInit, LazyInitParent and LazyInitChild.| Modifier and Type | Field and Description |
|---|---|
static ExtensionSupport |
SUPPORT
ExtensionSupport related to this handler supposed to be used when
configuring extension handlers in IBeanFactorys, for example in
ProxyIBeanFactory.Builder#withInterfaceSupport(ExtensionSupport). |
| Constructor and Description |
|---|
LazyInitHandler() |
| Modifier and Type | Method and Description |
|---|---|
Object |
interceptGetterCall(IBeanContext<?> context,
IBeanFieldMetaInfo fieldMeta,
Object returnValue,
Object proxyInstance)
Called as an optional hook with every getter call on an IBean.
|
void |
onInitStateful(Object proxyInstance,
IBeanTypeMetaInfo<?> metaInfo,
IBeanFactory factory)
Initialization method for stateful handlers that is called after
initialization of the IBean.
|
handleExtendedInterfaceCallclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinterceptSetterCallpublic static final ExtensionSupport SUPPORT
ExtensionSupport related to this handler supposed to be used when
configuring extension handlers in IBeanFactorys, for example in
ProxyIBeanFactory.Builder#withInterfaceSupport(ExtensionSupport).public void onInitStateful(Object proxyInstance, IBeanTypeMetaInfo<?> metaInfo, IBeanFactory factory)
ExtensionHandlerExtensionHandler implementation is created for
each new IBean. After the IBean itself and all handlers created this
method is called on all stateful handlers. This method should therefore
be overwritten if a handler needs some initialization after creation.
The default implementation does nothing.
proxyInstance - the IBean instancemetaInfo - meta information about the IBeanfactory - the factory that creates the IBean instancepublic Object interceptGetterCall(IBeanContext<?> context, IBeanFieldMetaInfo fieldMeta, Object returnValue, Object proxyInstance)
ExtensionHandlerExtensionHandler can implement this method to hook into the
getter call. It can just peak on the return value or it can even change
it or throw an exception.
When you have several extension handlers registered for an IBean type the
intercept calls will be called in the order in which the handlers are
registered in the ProxyIBeanFactory. See also
ProxyIBeanFactory.Builder.withInterfaceSupport(ExtensionSupport).
The default implementation just returns returnValue.
context - provides meta information about the IBeanfieldMeta - provides meta information about the field related to the
getterreturnValue - the current return value of the getter. This must not match to
the field value of the IBean as the value might have already
been changed by intercept calls from other handlersproxyInstance - the IBean instance itselfreturnValue