Class ServiceExtensionLoader
java.lang.Object
org.jboss.shrinkwrap.impl.base.ServiceExtensionLoader
- All Implemented Interfaces:
ExtensionLoader
ServiceExtensionLoader
This class is the default strategy to load extensions when an instance of ExtensionLoader is not provided to
the ConfigurationBuilder and the ConfigurationBuilder.build() method is invoked. If the
ConfigurationBuilder doesn't provide any ClassLoader, ConfigurationBuilder.build() defaults
to a one-element collection holding the TCCL. The classLoaders are used to find the
provider-configuration file for the extension to be loaded in META-INF/services/. This provider-configuration file is
used to make an instance of the SPI implementation and cached in cache.
- Version:
- $Revision: $
- Author:
- Aslak Knutsen, Ken Gullaksen
-
Constructor Summary
ConstructorsConstructorDescriptionServiceExtensionLoader(Iterable<ClassLoader> classLoaders) Creates a new instance, using the specifiedClassLoaders to create extensions -
Method Summary
Modifier and TypeMethodDescription<T extends Assignable>
ServiceExtensionLoaderaddOverride(Class<T> extensionClass, Class<? extends T> extensionImplClass) <T extends Archive<T>>
ArchiveFormat<T extends Assignable>
StringgetExtensionFromExtensionMapping(Class<T> type) booleanisOverridden(Class<?> extensionClass) Check to see if a specific extension interface is being overloaded<T extends Assignable>
T
-
Constructor Details
-
ServiceExtensionLoader
Creates a new instance, using the specifiedClassLoaders to create extensions- Parameters:
classLoaders- The class loaders to be used to load extension implementations- Throws:
IllegalArgumentException- If theClassLoaderis not specified
-
-
Method Details
-
load
public <T extends Assignable> T load(Class<T> extensionClass, Archive<?> baseArchive) throws UnknownExtensionTypeException - Specified by:
loadin interfaceExtensionLoader- Throws:
UnknownExtensionTypeException- See Also:
-
addOverride
public <T extends Assignable> ServiceExtensionLoader addOverride(Class<T> extensionClass, Class<? extends T> extensionImplClass) - Specified by:
addOverridein interfaceExtensionLoader- See Also:
-
getExtensionFromExtensionMapping
- Specified by:
getExtensionFromExtensionMappingin interfaceExtensionLoader- See Also:
-
getArchiveFormatFromExtensionMapping
- Specified by:
getArchiveFormatFromExtensionMappingin interfaceExtensionLoader- See Also:
-
isOverridden
Check to see if a specific extension interface is being overloaded- Parameters:
extensionClass- The ExtensionType interface class- Returns:
- true if found
-