Class LazyInitHandler

    • Constructor Detail

      • LazyInitHandler

        public LazyInitHandler()
    • Method Detail

      • onInitStateful

        public void onInitStateful​(Object proxyInstance,
                                   IBeanTypeMetaInfo<?> metaInfo,
                                   IBeanFactory factory)
        Description copied from interface: ExtensionHandler
        Initialization method for stateful handlers that is called after initialization of the IBean. If a handler is registered as stateful a new instance of the ExtensionHandler 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.

        Parameters:
        proxyInstance - the IBean instance
        metaInfo - meta information about the IBean
        factory - the factory that creates the IBean instance
      • interceptGetterCall

        public Object interceptGetterCall​(IBeanContext<?> context,
                                          IBeanFieldMetaInfo fieldMeta,
                                          Object returnValue,
                                          Object proxyInstance)
        Description copied from interface: ExtensionHandler
        Called as an optional hook with every getter call on an IBean. Getter calls on IBeans are handled by the IBean implementation itself but an ExtensionHandler 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.

        Parameters:
        context - provides meta information about the IBean
        fieldMeta - provides meta information about the field related to the getter
        returnValue - 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 handlers
        proxyInstance - the IBean instance itself
        Returns:
        the value to be returned from the getter call. If you do not want to change the getter return value just pass the value provided in returnValue