Interface JStachioExtensions


public interface JStachioExtensions
A container that will hold all resolved JStachioExtensions and consolidate them to a single instances of various services.
Author:
agentgt
API Note
While this interface looks similar to JStachioExtension it is not an extension but rather an immutable bean like container. The methods are purposely java bean style (which is not the default in JStachio as JStachio prefers newer record like accessor method names) to support as many frameworks as possible.
  • Method Details

    • of

      static JStachioExtensions of(Iterable<? extends JStachioExtension> extensions)
      Resolve from an iterable of extensions that usually come from some discovery mechanism like the ServiceLoader or a DI framework. The order of the extensions is important and primacy order takes precedence!
      Parameters:
      extensions - found extensions.
      Returns:
      bean like container of services.
    • of

      static JStachioExtensions of(Stream<? extends JStachioExtension> extensions)
      Resolve from a stream of extensions that usually come from some discovery mechanism like the ServiceLoader or a DI framework. The order of the extensions is important and primacy order takes precedence!
      Parameters:
      extensions - found extensions.
      Returns:
      bean like container of services.
    • of

      static JStachioExtensions of()
      Resolves extensions from the ServiceLoader with JStachioExtension as the SPI.
      Returns:
      jstachio extensions found by the ServiceLoader
    • getConfig

      JStachioConfig getConfig()
      Composite Config where the first config that returns a nonnull for JStachioConfig.getProperty(String) is used.
      Returns:
      config
    • getFilter

      JStachioFilter getFilter()
      Composite Filter where the ordering of the filter is based on a combination of JStachioFilter.order() first and then the order in the iterable passed to of(Iterable).
      Returns:
      filter
    • getTemplateFinder

      JStachioTemplateFinder getTemplateFinder()
      Composite Template finder where the first template finder that finds a template is used.
      Returns:
      template finder
    • getExtensions

      List<JStachioExtension> getExtensions()
      The orignal contained extensions excluding the composites.
      Returns:
      found services
    • findExtension

      default <T extends JStachioExtension> Optional<T> findExtension(Class<T> c)
      Finds a specific implementation using Class.isAssignableFrom(Class).
      Type Parameters:
      T - the implementation type
      Parameters:
      c - the implementation type.
      Returns:
      an implementation if found