Interface JStachioExtensionProvider

All Superinterfaces:
JStachioExtension
All Known Implementing Classes:
JMustacheRenderer, SpringJStachioExtension

public non-sealed interface JStachioExtensionProvider extends JStachioExtension
An extension that is a factory that provides other extensions. All methods are optional (default) so that implementations can decide what particularly plugins/services they want to provide. This is extension is useful if there is configuration logic that needs to happen before creation. See init(JStachioConfig) and provideConfig().
Author:
agentgt
See Also:
  • Method Details

    • provideFilter

      default @Nullable JStachioFilter provideFilter()
      Provide a filter or not. The final filter is a composite and becomes a filter chain.
      Returns:
      filter if this service provider provies one or null
    • provideConfig

      default @Nullable JStachioConfig provideConfig()
      Provide a config or not. The final config is a composite of all the found configs.

      Specifically if multiple instances of JStachioExtension are found that return a nonnull they will be combined by looping through all of them to find a nonnull value for JStachioConfig.getProperty(String). If no configs are provided or no services found JStachioExtensions instance will use the default config which uses System.getProperties().

      Returns:
      config if this service provides one or null
      API Note
      This method is called before init(JStachioConfig)
    • provideTemplateFinder

      Provide a template finder or not. The final template finder is a composite of all the other ones found. See JStachioTemplateFinder.order() for ordering details.

      If no template finders are provided then the default template finder that uses reflection and the ServiceLoader is used.

      Returns:
      template finder or not
    • init

      default void init(JStachioConfig config)
      Called before the extensions are used but after provideConfig(). See provideConfig() on how the config is consolidated to a single config.
      Parameters:
      config - the composite config never null
    • of

      Creates a provider from an extension. If the extension is a provider than it is returned without wrapping. If the extension represent multiple types of extensions the returned provider will provide all of them.
      Parameters:
      extension - the extension to be wrapped.
      Returns:
      provider that will provide the extension