Class DefaultInterceptorChain<OPERATION,​RESULT,​INTERCEPTOR_TYPE extends Interceptor>

    • Constructor Detail

      • DefaultInterceptorChain

        public DefaultInterceptorChain​(OPERATION operation,
                                       List<INTERCEPTOR_TYPE> interceptors,
                                       BiFunction<INTERCEPTOR_TYPE,​InterceptorChain<OPERATION,​RESULT,​INTERCEPTOR_TYPE>,​RESULT> interceptorMethodInvoker,
                                       Supplier<RESULT> defaultBehaviour)
        Create a new InterceptorChain instance for the provided operation
        Parameters:
        operation - the operation to intercept, aka. the argument to the interceptor
        interceptors - the ordered Interceptor's (can be an empty List if no interceptors have been configured)
        interceptorMethodInvoker - the function that's responsible for invoking the matching Interceptor method
        defaultBehaviour - the default behaviour for the given operation in case none of the interceptors provided a different result and stopped the interceptor chain
    • Method Detail

      • sortInterceptorsByOrder

        public static <INTERCEPTOR_TYPE> List<INTERCEPTOR_TYPE> sortInterceptorsByOrder​(List<INTERCEPTOR_TYPE> interceptors)
        Order the interceptors according to the specified InterceptorOrder annotation (if the annotation is left out then the default order is 10)
        Type Parameters:
        INTERCEPTOR_TYPE - the type of interceptor contained in the list
        Parameters:
        interceptors - the list of interceptors that should be ordered (expects a mutable list that can be reordered)
        Returns:
        the interceptors parameter after it has been reordered