Class BuildCompatibleExtensionLoader
java.lang.Object
org.jboss.weld.lite.extension.translator.BuildCompatibleExtensionLoader
A helper class used to load all implementations of
BuildCompatibleExtension via service loader which also
allows to specify a ClassLoader for this process.
Main use of this class is to give integrators the ability to pre-load all classes and determine if there are any such
extensions. If the returned set is empty, there is no need to register LiteExtensionTranslator portable extension
which may save some bootstrap time.
- Author:
- Matej Novotny
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidClears out all discovered extensions.static List<Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension>>Uses service loader to discover allBuildCompatibleExtensionimplementations.static List<Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension>>getBuildCompatibleExtensions(ClassLoader classLoader) Uses service classLoader to discover allBuildCompatibleExtensionimplementations.
-
Method Details
-
getBuildCompatibleExtensions
public static List<Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension>> getBuildCompatibleExtensions(ClassLoader classLoader) Uses service classLoader to discover allBuildCompatibleExtensionimplementations. The parameter is aClassLoaderthat is to be used for this discovery. Returns a collection of all discovered extensions; can be empty but can never returnnull.- Parameters:
classLoader-ClassLoaderwith which classes will be loaded- Returns:
- collection of build compatible extensions or an empty collection if none was found
-
getBuildCompatibleExtensions
public static List<Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension>> getBuildCompatibleExtensions()Uses service loader to discover allBuildCompatibleExtensionimplementations. Returns a collection of all discovered extensions; can be empty but can never returnnull. This method variant usesThread.currentThread().getContextClassLoader()as the CL with which it attempts to load all services.- Returns:
- collection of build compatible extensions or an empty collection if none was found
-
clearDiscoveredExtensions
public static void clearDiscoveredExtensions()Clears out all discovered extensions. This is automatically performed from withinLiteExtensionTranslatoronce an instance of it is created.This is necessary because of testing environment where multiple deployments happen on the same running JVM and the static list could be therefore retained in between deployments.
-