Class ClassInjector.UsingReflection.Dispatcher.Indirect

    • Constructor Detail

      • Indirect

        protected Indirect​(java.lang.Object accessor,
                           java.lang.reflect.Method findLoadedClass,
                           java.lang.reflect.Method defineClass,
                           java.lang.reflect.Method getPackage,
                           java.lang.reflect.Method definePackage,
                           java.lang.reflect.Method getClassLoadingLock)
        Creates a new indirect class loading injection dispatcher.
        Parameters:
        accessor - An instance of the accessor class that is required for using it's intentionally non-static methods.
        findLoadedClass - An instance of ClassLoader.findLoadedClass(String).
        defineClass - An instance of ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain).
        getPackage - An instance of ClassLoader.getPackage(String) or ClassLoader#getDefinedPackage(String).
        definePackage - An instance of ClassLoader.definePackage(String, String, String, String, String, String, String, URL).
        getClassLoadingLock - The accessor method for using ClassLoader#getClassLoadingLock(String) or returning the supplied ClassLoader if this method does not exist on the current VM.
    • Method Detail

      • findClass

        public java.lang.Class<?> findClass​(java.lang.ClassLoader classLoader,
                                            java.lang.String name)
        Description copied from interface: ClassInjector.UsingReflection.Dispatcher
        Looks up a class from the given class loader.
        Specified by:
        findClass in interface ClassInjector.UsingReflection.Dispatcher
        Parameters:
        classLoader - The class loader for which a class should be located.
        name - The binary name of the class that should be located.
        Returns:
        The class for the binary name or null if no such class is defined for the provided class loader.
      • defineClass

        public java.lang.Class<?> defineClass​(java.lang.ClassLoader classLoader,
                                              java.lang.String name,
                                              byte[] binaryRepresentation,
                                              java.security.ProtectionDomain protectionDomain)
        Description copied from interface: ClassInjector.UsingReflection.Dispatcher
        Defines a class for the given class loader.
        Specified by:
        defineClass in interface ClassInjector.UsingReflection.Dispatcher
        Parameters:
        classLoader - The class loader for which a new class should be defined.
        name - The binary name of the class that should be defined.
        binaryRepresentation - The binary representation of the class.
        protectionDomain - The protection domain for the defined class.
        Returns:
        The defined, loaded class.
      • getPackage

        public java.lang.Package getPackage​(java.lang.ClassLoader classLoader,
                                            java.lang.String name)
        Description copied from interface: ClassInjector.UsingReflection.Dispatcher
        Looks up a package from a class loader.
        Specified by:
        getPackage in interface ClassInjector.UsingReflection.Dispatcher
        Parameters:
        classLoader - The class loader to query.
        name - The binary name of the package.
        Returns:
        The package for the given name as defined by the provided class loader or null if no such package exists.
      • definePackage

        public java.lang.Package definePackage​(java.lang.ClassLoader classLoader,
                                               java.lang.String name,
                                               java.lang.String specificationTitle,
                                               java.lang.String specificationVersion,
                                               java.lang.String specificationVendor,
                                               java.lang.String implementationTitle,
                                               java.lang.String implementationVersion,
                                               java.lang.String implementationVendor,
                                               java.net.URL sealBase)
        Description copied from interface: ClassInjector.UsingReflection.Dispatcher
        Defines a package for the given class loader.
        Specified by:
        definePackage in interface ClassInjector.UsingReflection.Dispatcher
        Parameters:
        classLoader - The class loader for which a package is to be defined.
        name - The binary name of the package.
        specificationTitle - The specification title of the package or null if no specification title exists.
        specificationVersion - The specification version of the package or null if no specification version exists.
        specificationVendor - The specification vendor of the package or null if no specification vendor exists.
        implementationTitle - The implementation title of the package or null if no implementation title exists.
        implementationVersion - The implementation version of the package or null if no implementation version exists.
        implementationVendor - The implementation vendor of the package or null if no implementation vendor exists.
        sealBase - The seal base URL or null if the package should not be sealed.
        Returns:
        The defined package.