- 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.
A factory that may need config to provide.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThrown if a provider fails and a description needs to be added. -
Method Summary
Modifier and TypeMethodDescriptiondefault LogProvider<T> Wraps with an error description.default LogProvider<T> Wraps with an error description.static <U> LogProvider<List<U>> flatten(List<LogProvider<U>> providers) Flattens a list of providers to a single provider of a list.static <U> LogProvider<U> of(U instance) Creates a provider of instance that is already configured.Creates the component from config.static <U> @Nullable UprovideOrNull(@Nullable LogProvider<U> provider, String name, LogConfig config) Convenience for flattening nullable providers.
-
Method Details
-
provide
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 providername- name of parent component and can be ignored if not needed.config- config used to provide if not null.- Returns:
- maybe null component.
-
of
Creates a provider of instance that is already configured.- Type Parameters:
U- component- Parameters:
instance- component instance.- Returns:
- this.
-
describe
Wraps with an error description.- Parameters:
description- description function passed the name and returns description.- Returns:
- wrapped provider.
-
describe
Wraps with an error description.- Parameters:
description- description function passed the name and returns description.- Returns:
- wrapped provider.
-
flatten
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.
-