Interface HttpAnnotationProcessor

All Known Implementing Classes:
DefaultHttpAnnotationParser.FirstRequestQueryParamProcessor, DefaultHttpAnnotationParser.RequestBodyProcessor, DefaultHttpAnnotationParser.RequestHeaderProcessor, DefaultHttpAnnotationParser.RequestPathParamProcessor, DefaultHttpAnnotationParser.RequestPathProcessor, DefaultHttpAnnotationParser.RequestQueryParamProcessor
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface HttpAnnotationProcessor
A processor for an annotation which can be added to a http handler parameter.
Since:
4.0
  • Method Details

    • buildPreprocessor

      Builds a preprocessor for the annotation which is supported by this processor. The preprocessor will be called before the actual http handler is called, allowing the parser to modify or even abort the request.

      All processors will be called for a method, unless this processor overrides the shouldProcess method and decides whether to handle the method or not.

      If this processor returns null it indicates that it has no interest in adding a preprocessor.

      Parameters:
      method - the method which gets processed currently.
      handlerInstance - the instance of the handler class in which the method is located.
      Returns:
      a preprocessor for a http request context, or null if there is no need for a preprocessor.
      Throws:
      NullPointerException - if the given method or handler instance is null.
    • shouldProcess

      default boolean shouldProcess(@NonNull @NonNull Method method, @NonNull @NonNull Object handlerInstance)
      Checks if this processor should process the given method. This defaults to true.
      Parameters:
      method - the method which gets processed currently.
      handlerInstance - the instance of the handler class in which the method is located.
      Returns:
      true if this processor wants to provide a preprocessor, false otherwise.
      Throws:
      NullPointerException - if the given method or handler instance is null.