Interface LogProvider<T>

Type Parameters:
T - component
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 LogProvider<T>
A factory that may need config to provide.
  • Method Details

    • provide

      T provide(String name, LogConfig config)
      Creates the component from config. The component is not always guaranteed to be new object.
      Parameters:
      name - config name of the parent component.
      config - config.
      Returns:
      component.
    • provideOrNull

      static <U> @Nullable U provideOrNull(@Nullable LogProvider<U> provider, String name, LogConfig config)
      Convenience for flattening nullable providers.
      Type Parameters:
      U - component
      Parameters:
      provider - nullable provider
      name - name of parent component and can be ignored if not needed.
      config - config used to provide if not null.
      Returns:
      maybe null component.
    • of

      static <U> LogProvider<U> of(U instance)
      Creates a provider of instance that is already configured.
      Type Parameters:
      U - component
      Parameters:
      instance - component instance.
      Returns:
      this.
    • describe

      default LogProvider<T> describe(String description)
      Wraps with an error description.
      Parameters:
      description - description function passed the name and returns description.
      Returns:
      wrapped provider.
    • describe

      default LogProvider<T> describe(Function<String,String> description)
      Wraps with an error description.
      Parameters:
      description - description function passed the name and returns description.
      Returns:
      wrapped provider.
    • flatten

      static <U> LogProvider<List<U>> flatten(List<LogProvider<U>> providers)
      Flattens a list of providers to a single provider of a list.
      Type Parameters:
      U - provider type.
      Parameters:
      providers - list of providers.
      Returns:
      provider of list.