- All Known Subinterfaces:
PatternConfig,RainbowGumServiceProvider.Configurator,RainbowGumServiceProvider.PropertiesProvider,RainbowGumServiceProvider.RainbowGumEagerLoad,RainbowGumServiceProvider.RainbowGumProvider
- All Known Implementing Classes:
AvajePropertiesProvider,DisruptorConfigurator,GelfEncoderConfigurator,JAnsiConfigurator,JULConfigurator,LoggerDecoratorService,PatternConfigurator,PatternKeywordProvider,RabbitMQInitializer
public sealed interface RainbowGumServiceProvider
permits RainbowGumServiceProvider.Configurator, RainbowGumServiceProvider.PropertiesProvider, RainbowGumServiceProvider.RainbowGumProvider, RainbowGumServiceProvider.RainbowGumEagerLoad
RainbowGum SPI. The Rainbow Gum SPI uses the
Initialization Order:
ServiceLoader with the
registration of this class and NOT the non-sealed
subclasses! Read the ServiceLoader doc to understand how to register a
service loader class. A common option is to use an annotation processor to generate the
META-INF/services registration. There are several libraries that can do
this:
However if your application is fully modularized (has a module-info.java)
you will need to use the module-info syntax:
provides io.jstach.rainbowgum.spi.RainbowGumServiceProvider with com.mycompany.SomeService;
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceCalled afterLogConfighas been loaded to do various custom initialization like registeringLogOutput.OutputProviders.static enumProviders sometimes need multiple passes to support dependencies without using true dependency injection.static interfaceProvides properties and or register services.static interfaceThis is a marker interface that indicates that a facade implementation will do the eager loading of RainbowGum.static interfaceImplement to create a custom RainbowGum. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default amount of passes made to resolve registrators or configurators. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T extends RainbowGumServiceProvider>
Stream<T> findProviders(ServiceLoader<RainbowGumServiceProvider> loader, Class<T> providerType) Finds service providers based on type.static RainbowGumprovide()Will load all RainbowGum SPI to create a RainbowGum powered from the ServiceLoader using the current thread context class loader if avaiable otherwise the system classloader.static RainbowGumWill load all RainbowGum SPI to create a RainbowGum powered from the ServiceLoader.static LogConfigCreates config from service loader.
-
Field Details
-
PASSES
The default amount of passes made to resolve registrators or configurators.- See Also:
-
-
Method Details
-
findProviders
static <T extends RainbowGumServiceProvider> Stream<T> findProviders(ServiceLoader<RainbowGumServiceProvider> loader, Class<T> providerType) Finds service providers based on type.- Type Parameters:
T- provider interface type.- Parameters:
loader- service loader to use.providerType- provider class.- Returns:
- stream containing only provider of the given type.
-
provideConfig
Creates config from service loader.- Parameters:
loader- service loader.- Returns:
- config.
-
provide
Will load all RainbowGum SPI to create a RainbowGum powered from the ServiceLoader.- Parameters:
loader- service loader to use.- Returns:
- Rainbow Gum.
-
provide
Will load all RainbowGum SPI to create a RainbowGum powered from the ServiceLoader using the current thread context class loader if avaiable otherwise the system classloader.- Returns:
- Rainbow Gum.
-