Class ServiceClassNameBuilder
java.lang.Object
com.fathzer.plugin.loader.commons.AbstractServiceClassNameBuilder<ClassLoader>
com.fathzer.plugin.loader.classloader.ServiceClassNameBuilder
- All Implemented Interfaces:
ClassNameBuilder<ClassLoader>
A
ClassNameBuilder that retrieves the class names from a ClassLoader in the same way as ServiceLoader.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(ClassLoader loader, Class<?> aClass) Gets the class names of the plugin implementations.voidsetUrlFilter(Predicate<URL> urlFilter) Sets a filter to narrow the search to some sources.Methods inherited from class com.fathzer.plugin.loader.commons.AbstractServiceClassNameBuilder
getBufferedReader, getServiceFilePath, toClassNames
-
Constructor Details
-
ServiceClassNameBuilder
public ServiceClassNameBuilder()Constructor.
By default, this instance scans all sources in the class loader.- See Also:
-
-
Method Details
-
setUrlFilter
Sets a filter to narrow the search to some sources.- Parameters:
urlFilter- A predicate. All URL sources that does not match this predicate will be exclude from the search.
-
get
Description copied from interface:ClassNameBuilderGets the class names of the plugin implementations.- Parameters:
loader- The jar that contains the pluginaClass- The interface or abstract class implemented by the plugin.- Returns:
- The class names of the plugin implementation (typically a list of argument of the loadClass method of a ClassLoader).
- Throws:
IOException- if something went wrong
-