Class ServiceClassNameBuilder

java.lang.Object
com.fathzer.plugin.loader.commons.AbstractServiceClassNameBuilder<ClassLoader>
com.fathzer.plugin.loader.classloader.ServiceClassNameBuilder
All Implemented Interfaces:
ClassNameBuilder<ClassLoader>

public class ServiceClassNameBuilder extends AbstractServiceClassNameBuilder<ClassLoader>
A ClassNameBuilder that retrieves the class names from a ClassLoader in the same way as ServiceLoader.
  • Constructor Details

    • ServiceClassNameBuilder

      public ServiceClassNameBuilder()
      Constructor.
      By default, this instance scans all sources in the class loader.
      See Also:
  • Method Details

    • setUrlFilter

      public void setUrlFilter(Predicate<URL> urlFilter)
      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

      public Set<String> get(ClassLoader loader, Class<?> aClass) throws IOException
      Description copied from interface: ClassNameBuilder
      Gets the class names of the plugin implementations.
      Parameters:
      loader - The jar that contains the plugin
      aClass - 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