Class ClassFileLocator.ForClassLoader.WeaklyReferenced

    • Constructor Detail

      • WeaklyReferenced

        protected WeaklyReferenced​(ClassLoader classLoader)
        Creates a class file locator for a class loader that is weakly referenced.
        Parameters:
        classLoader - The class loader to represent.
    • Method Detail

      • of

        public static ClassFileLocator of​(ClassLoader classLoader)
        Creates a class file locator for a given class loader. If the class loader is not the bootstrap class loader or the system class loader which cannot be collected, the class loader is only weakly referenced.
        Parameters:
        classLoader - The class loader to be used. If this class loader represents the bootstrap class loader which is represented by the null value, this system class loader is used instead.
        Returns:
        A corresponding source locator.
      • locate

        public ClassFileLocator.Resolution locate​(String name)
                                           throws IOException
        Locates the class file for a given type and returns the binary data of the class file.
        Specified by:
        locate in interface ClassFileLocator
        Parameters:
        name - The name of the type to locate a class file representation for.
        Returns:
        Any binary representation of the type which might be illegal.
        Throws:
        IOException - If reading a class file causes an error.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object