Class ClassFileLocator.PackageDiscriminating

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ClassFileLocator
    Enclosing interface:
    ClassFileLocator

    @Enhance
    public static class ClassFileLocator.PackageDiscriminating
    extends java.lang.Object
    implements ClassFileLocator
    A class file locator that discriminates by a type's package.
    • Field Detail

      • classFileLocators

        private final java.util.Map<java.lang.String,​ClassFileLocator> classFileLocators
        A mapping of package names to class file locators.
    • Constructor Detail

      • PackageDiscriminating

        public PackageDiscriminating​(java.util.Map<java.lang.String,​ClassFileLocator> classFileLocators)
        Creates a new package-discriminating class file locator.
        Parameters:
        classFileLocators - A mapping of package names to class file locators where an empty string donates the default package.
    • Method Detail

      • locate

        public ClassFileLocator.Resolution locate​(java.lang.String name)
                                           throws java.io.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:
        java.io.IOException - If reading a class file causes an error.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException