Interface HttpAnnotationParser<T extends HttpComponent<T>>

Type Parameters:
T - the type of http component associated with this parser.
All Known Implementing Classes:
DefaultHttpAnnotationParser

public interface HttpAnnotationParser<T extends HttpComponent<T>>
A parser which can convert and register annotated http elements, supporting custom annotations as well.
Since:
4.0
  • Method Details

    • httpComponent

      @NonNull T httpComponent()
      Get the http component which is associated with this parser. All handlers parsed using this parser will get registered into that component.
      Returns:
      the http component associated with this parser.
    • annotationProcessors

      Get an unmodifiable view of all annotation processors which were registered to this parser.
      Returns:
      all annotation processors registered to this parser.
    • registerAnnotationProcessor

      Registers an annotation processor to this parser.
      Parameters:
      processor - the processor to register.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given processor is null.
    • unregisterAnnotationProcessor

      Unregisters an annotation processor from this parser if previously registered.
      Parameters:
      processor - the processor to unregister.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given processor is null.
    • unregisterAnnotationProcessors

      @NonNull @NonNull HttpAnnotationParser<T> unregisterAnnotationProcessors(@NonNull @NonNull ClassLoader classLoader)
      Unregisters all annotation processors from this parser whose classes were loaded by the given class loader.
      Parameters:
      classLoader - the loader of the processor classes to unregister.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given class loader is null.
    • parseAndRegister

      @NonNull @NonNull HttpAnnotationParser<T> parseAndRegister(@NonNull @NonNull Class<?> handlerClass)
      Parses all non-static http handlers methods annotated with @HttpRequestHandler in the given class instance. This method will call all previously registered annotation processors and build context preprocessors from them, then register the final parsed handler to the http component associated with this parser.
      Parameters:
      handlerClass - the class in which the handler methods to register are located.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given handler instance is null.
      IllegalArgumentException - if annotating a static method, not taking a context as the first arg or if the annotation defines no paths or http methods to handle.
      InaccessibleObjectException - if a http handler method is not accessible.
    • parseAndRegister

      @NonNull @NonNull HttpAnnotationParser<T> parseAndRegister(@NonNull @NonNull Object handlerInstance)
      Parses all non-static http handlers methods annotated with @HttpRequestHandler in the given class instance. This method will call all previously registered annotation processors and build context preprocessors from them, then register the final parsed handler to the http component associated with this parser.
      Parameters:
      handlerInstance - the instance of the class in which the handler methods to register are located.
      Returns:
      the same instance as used to call the method, for chaining.
      Throws:
      NullPointerException - if the given handler instance is null.
      IllegalArgumentException - if annotating a static method, not taking a context as the first arg or if the annotation defines no paths or http methods to handle.
      InaccessibleObjectException - if a http handler method is not accessible.