Interface ExtensionHandlerFactory

All Known Subinterfaces:
HandlerFactory

public interface ExtensionHandlerFactory
A factory to create ExtensionHandler instances.
  • Method Details

    • accepts

      boolean accepts(Class<?> extensionType, Method method)
      Determines whether the factory can create an ExtensionHandler for combination of extension type and method.
      Parameters:
      extensionType - The extension type class
      method - A method
      Returns:
      True if the factory can create an extension handler for extension type and method, false otherwise
    • createExtensionHandler

      Optional<ExtensionHandler> createExtensionHandler(Class<?> extensionType, Method method)
      Returns an ExtensionHandler instance for a extension type and method combination.
      Parameters:
      extensionType - The extension type class
      method - A method
      Returns:
      An ExtensionHandler instance wrapped into an Optional. The optional can be empty. This is necessary to retrofit old code that does not have an accept/build code pair but unconditionally tries to build a handler and returns empty if it can not. New code should always return Optional.of(extensionHandler} and never return Optional.empty()