Class SpiHelper
java.lang.Object
io.opentelemetry.sdk.autoconfigure.internal.SpiHelper
This class is internal and is hence not for public use. Its APIs are unstable and can change at
any time.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ComponentLoaderprivate final Set<AutoConfigureListener> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SpiHelpercreate(ComponentLoader componentLoader) Create aSpiHelperwhich loads SPIs using thecomponentLoader.static SpiHelpercreate(ClassLoader classLoader) Create aSpiHelperwhich loads SPIs using theclassLoader.Return the backing underlyingComponentLoader.Return the set of SPIs loaded which implementAutoConfigureListener.<T> List<T> Load implementations of an SPI.<T> TloadComponent(Class<T> type, String name, StructuredConfigProperties config) Find a registeredComponentProviderwithComponentProvider.getType()matchingtype,ComponentProvider.getName()matchingname, and callComponentProvider.create(StructuredConfigProperties)with the givenconfig.<T,S> NamedSpiManager <T> loadConfigurable(Class<S> spiClass, Function<S, String> getName, BiFunction<S, ConfigProperties, T> getConfigurable, ConfigProperties config) Load implementations of an SPI which are configurable (i.e.loadOrdered(Class<T> spiClass) Load implementations of an ordered SPI (i.e.private voidmaybeAddListener(Object object) static ComponentLoaderserviceComponentLoader(ClassLoader classLoader) Create aComponentLoaderwhich loads using theclassLoader.
-
Field Details
-
componentLoader
-
listeners
-
-
Constructor Details
-
SpiHelper
-
-
Method Details
-
create
Create aSpiHelperwhich loads SPIs using theclassLoader. -
create
Create aSpiHelperwhich loads SPIs using thecomponentLoader. -
serviceComponentLoader
Create aComponentLoaderwhich loads using theclassLoader. -
getComponentLoader
Return the backing underlyingComponentLoader. -
loadConfigurable
public <T,S> NamedSpiManager<T> loadConfigurable(Class<S> spiClass, Function<S, String> getName, BiFunction<S, ConfigProperties, T> getConfigurable, ConfigProperties config) Load implementations of an SPI which are configurable (i.e. they acceptConfigProperties.- Type Parameters:
T- the configurable typeS- the SPI type- Parameters:
spiClass- the SPI classgetName- function returning the name of an SPI implementationgetConfigurable- function returning a configured instanceconfig- the configuration to pass to invocations of#getConfigurable- Returns:
- a
NamedSpiManagerused to access configured instances of the SPI by name
-
loadComponent
Find a registeredComponentProviderwithComponentProvider.getType()matchingtype,ComponentProvider.getName()matchingname, and callComponentProvider.create(StructuredConfigProperties)with the givenconfig.- Throws:
ConfigurationException- if no matching providers are found, or if multiple are found (i.e. conflict), or ifComponentProvider.create(StructuredConfigProperties)throws
-
loadOrdered
Load implementations of an ordered SPI (i.e. implementsOrdered).- Type Parameters:
T- the SPI type- Parameters:
spiClass- the SPI class- Returns:
- list of SPI implementations, in order
-
load
Load implementations of an SPI.- Type Parameters:
T- the SPI type- Parameters:
spiClass- the SPI class- Returns:
- list of SPI implementations
-
maybeAddListener
-
getListeners
Return the set of SPIs loaded which implementAutoConfigureListener.
-