Class NullSafeHandler

    • Constructor Detail

      • NullSafeHandler

        public NullSafeHandler()
    • Method Detail

      • 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