Class AnnotationMethodInterceptor

    • Constructor Detail

      • AnnotationMethodInterceptor

        public AnnotationMethodInterceptor​(AnnotationHandler handler)
        Constructs an AnnotationMethodInterceptor with the AnnotationHandler that will be used to process annotations of a corresponding type.
        Parameters:
        handler - the handler to delegate to for processing the annotation.
      • AnnotationMethodInterceptor

        public AnnotationMethodInterceptor​(AnnotationHandler handler,
                                           AnnotationResolver resolver)
        Constructs an AnnotationMethodInterceptor with the AnnotationHandler that will be used to process annotations of a corresponding type, using the specified AnnotationResolver to acquire annotations at runtime.
        Parameters:
        handler - the handler to use to process any discovered annotation
        resolver - the resolver to use to locate/acquire the annotation
        Since:
        1.1
    • Method Detail

      • getHandler

        public AnnotationHandler getHandler()
        Returns the AnnotationHandler used to perform authorization behavior based on an annotation discovered at runtime.
        Returns:
        the AnnotationHandler used to perform authorization behavior based on an annotation discovered at runtime.
      • setHandler

        public void setHandler​(AnnotationHandler handler)
        Sets the AnnotationHandler used to perform authorization behavior based on an annotation discovered at runtime.
        Parameters:
        handler - the AnnotationHandler used to perform authorization behavior based on an annotation discovered at runtime.
      • getResolver

        public AnnotationResolver getResolver()
        Returns the AnnotationResolver to use to acquire annotations from intercepted methods at runtime. The annotation is then used by the handler to perform authorization logic.
        Returns:
        the AnnotationResolver to use to acquire annotations from intercepted methods at runtime.
        Since:
        1.1
      • setResolver

        public void setResolver​(AnnotationResolver resolver)
        Returns the AnnotationResolver to use to acquire annotations from intercepted methods at runtime. The annotation is then used by the handler to perform authorization logic.
        Parameters:
        resolver - the AnnotationResolver to use to acquire annotations from intercepted methods at runtime.
        Since:
        1.1
      • supports

        public boolean supports​(MethodInvocation mi)
        Returns true if this interceptor supports, that is, should inspect, the specified MethodInvocation, false otherwise.

        The default implementation simply does the following:

        return getAnnotation(mi) != null

        Parameters:
        mi - the MethodInvocation for the method being invoked.
        Returns:
        true if this interceptor supports, that is, should inspect, the specified MethodInvocation, false otherwise.
      • getAnnotation

        protected  getAnnotation​(MethodInvocation mi)
        Returns the Annotation that this interceptor will process for the specified method invocation.

        The default implementation acquires the annotation using an annotation resolver using the internal annotation handler's annotationClass.

        Parameters:
        mi - the MethodInvocation wrapping the Method from which the Annotation will be acquired.
        Returns:
        the Annotation that this interceptor will process for the specified method invocation.