Class BuildCompatibleExtensionLoader
- java.lang.Object
-
- org.jboss.weld.lite.extension.translator.BuildCompatibleExtensionLoader
-
public class BuildCompatibleExtensionLoader extends Object
A helper class used to load all implementations ofBuildCompatibleExtensionvia service loader which also allows to specify aClassLoaderfor 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
LiteExtensionTranslatorportable extension which may save some bootstrap time.- Author:
- Matej Novotny
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearDiscoveredExtensions()Clears out all discovered extensions.static List<Class<? extends jakarta.enterprise.inject.build.compatible.spi.BuildCompatibleExtension>>getBuildCompatibleExtensions()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 Detail
-
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.
-
-