Class ClassLoaderServiceImpl

    • Constructor Detail

      • ClassLoaderServiceImpl

        public ClassLoaderServiceImpl()
        Constructs a ClassLoaderServiceImpl with standard set-up
      • ClassLoaderServiceImpl

        public ClassLoaderServiceImpl​(ClassLoader classLoader)
        Constructs a ClassLoaderServiceImpl with the given ClassLoader
        Parameters:
        classLoader - The ClassLoader to use
      • ClassLoaderServiceImpl

        public ClassLoaderServiceImpl​(Collection<ClassLoader> providedClassLoaders,
                                      TcclLookupPrecedence lookupPrecedence)
        Constructs a ClassLoaderServiceImpl with the given ClassLoader instances
        Parameters:
        providedClassLoaders - The ClassLoader instances to use
        lookupPrecedence - The lookup precedence of the thread context ClassLoader
    • Method Detail

      • fromConfigSettings

        @Deprecated
        public static ClassLoaderServiceImpl fromConfigSettings​(Map configValues)
        Deprecated.
        No longer used/supported!
        No longer used/supported!
        Parameters:
        configValues - The config values
        Returns:
        The built service
      • classForName

        public <T> Class<T> classForName​(String className)
        Description copied from interface: ClassLoaderService
        Locate a class by name.
        Specified by:
        classForName in interface ClassLoaderService
        Type Parameters:
        T - The returned class type.
        Parameters:
        className - The name of the class to locate
        Returns:
        The class reference
      • locateResource

        public URL locateResource​(String name)
        Description copied from interface: ClassLoaderService
        Locate a resource by name (classpath lookup).
        Specified by:
        locateResource in interface ClassLoaderService
        Parameters:
        name - The resource name.
        Returns:
        The located URL; may return null to indicate the resource was not found
      • locateResourceStream

        public InputStream locateResourceStream​(String name)
        Description copied from interface: ClassLoaderService
        Locate a resource by name (classpath lookup) and gets its stream.
        Specified by:
        locateResourceStream in interface ClassLoaderService
        Parameters:
        name - The resource name.
        Returns:
        The stream of the located resource; may return null to indicate the resource was not found
      • locateResources

        public List<URL> locateResources​(String name)
        Description copied from interface: ClassLoaderService
        Locate a series of resource by name (classpath lookup).
        Specified by:
        locateResources in interface ClassLoaderService
        Parameters:
        name - The resource name.
        Returns:
        The list of URL matching; may return null to indicate the resource was not found
      • loadJavaServices

        public <S> Collection<S> loadJavaServices​(Class<S> serviceContract)
        Description copied from interface: ClassLoaderService
        Discovers and instantiates implementations of the named service contract.

        NOTE : the terms service here is used differently than Service. Instead here we are talking about services as defined by ServiceLoader.

        Specified by:
        loadJavaServices in interface ClassLoaderService
        Type Parameters:
        S - The type of the service contract
        Parameters:
        serviceContract - The java type defining the service contract
        Returns:
        The ordered set of discovered services.
      • packageForNameOrNull

        public Package packageForNameOrNull​(String packageName)
        Description copied from interface: ClassLoaderService
        Loading a Package from the classloader. In case it's not found or an internal error (such as @see LinkageError occurs, we return null rather than throwing an exception. This is significantly different than loading a Class, as in all currently known usages, being unable to load the Package will only result in ignoring annotations on it - which is totally fine when the object doesn't exist. In case of other errors, implementations are expected to log a warning but it's still not treated as a fatal error.
        Specified by:
        packageForNameOrNull in interface ClassLoaderService
        Returns:
        the matching Package, or null.
      • stop

        public void stop()
        Description copied from interface: Stoppable
        Stop phase notification
        Specified by:
        stop in interface Stoppable