Package net.bytebuddy.dynamic.loading
Interface ClassInjector.UsingReflection.Dispatcher
-
- All Known Implementing Classes:
ClassInjector.UsingReflection.Dispatcher.Direct,ClassInjector.UsingReflection.Dispatcher.Direct.ForJava7CapableVm,ClassInjector.UsingReflection.Dispatcher.Direct.ForLegacyVm,ClassInjector.UsingReflection.Dispatcher.Initializable.Unavailable,ClassInjector.UsingReflection.Dispatcher.Unavailable,ClassInjector.UsingReflection.Dispatcher.UsingUnsafeInjection,ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride,ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride.ForJava7CapableVm,ClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverride.ForLegacyVm
- Enclosing class:
- ClassInjector.UsingReflection
protected static interface ClassInjector.UsingReflection.DispatcherA dispatcher for accessing aClassLoaderreflectively.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classClassInjector.UsingReflection.Dispatcher.CreationActionA creation action for a dispatcher.static classClassInjector.UsingReflection.Dispatcher.DirectA class injection dispatcher that is using reflection on theClassLoadermethods.static interfaceClassInjector.UsingReflection.Dispatcher.InitializableInitializes a dispatcher to make non-accessible APIs accessible.static classClassInjector.UsingReflection.Dispatcher.UnavailableRepresents an unsuccessfully loaded method lookup.static classClassInjector.UsingReflection.Dispatcher.UsingUnsafeInjectionAn indirect dispatcher that uses a redirection accessor class that was injected into the bootstrap class loader.static classClassInjector.UsingReflection.Dispatcher.UsingUnsafeOverrideA dispatcher implementation that usessun.misc.Unsafe#putBooleanto set theAccessibleObjectfield for making methods accessible.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Class<?>UNDEFINEDIndicates a class that is currently not defined.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Class<?>defineClass(java.lang.ClassLoader classLoader, java.lang.String name, byte[] binaryRepresentation, java.security.ProtectionDomain protectionDomain)Defines a class for the given class loader.java.lang.PackagedefinePackage(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)Defines a package for the given class loader.java.lang.Class<?>findClass(java.lang.ClassLoader classLoader, java.lang.String name)Looks up a class from the given class loader.java.lang.ObjectgetClassLoadingLock(java.lang.ClassLoader classLoader, java.lang.String name)Returns the lock for loading the specified class.java.lang.PackagegetDefinedPackage(java.lang.ClassLoader classLoader, java.lang.String name)Looks up a package from a class loader.java.lang.PackagegetPackage(java.lang.ClassLoader classLoader, java.lang.String name)Looks up a package from a class loader or its ancestor.
-
-
-
Method Detail
-
getClassLoadingLock
java.lang.Object getClassLoadingLock(java.lang.ClassLoader classLoader, java.lang.String name)Returns the lock for loading the specified class.- Parameters:
classLoader- the class loader to inject the class into.name- The name of the class.- Returns:
- The lock for loading this class.
-
findClass
java.lang.Class<?> findClass(java.lang.ClassLoader classLoader, java.lang.String name)Looks up a class from the given class loader.- 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
nullif no such class is defined for the provided class loader.
-
defineClass
java.lang.Class<?> defineClass(java.lang.ClassLoader classLoader, java.lang.String name, byte[] binaryRepresentation, java.security.ProtectionDomain protectionDomain)Defines a class for the given class loader.- 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.
-
getDefinedPackage
java.lang.Package getDefinedPackage(java.lang.ClassLoader classLoader, java.lang.String name)Looks up a package from a class loader. If the operation is not supported, falls back togetPackage(ClassLoader, String)- 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
nullif no such package exists.
-
getPackage
java.lang.Package getPackage(java.lang.ClassLoader classLoader, java.lang.String name)Looks up a package from a class loader or its ancestor.- 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 its ancestor, or
nullif no such package exists.
-
definePackage
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)Defines a package for the given class loader.- 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 ornullif no specification title exists.specificationVersion- The specification version of the package ornullif no specification version exists.specificationVendor- The specification vendor of the package ornullif no specification vendor exists.implementationTitle- The implementation title of the package ornullif no implementation title exists.implementationVersion- The implementation version of the package ornullif no implementation version exists.implementationVendor- The implementation vendor of the package ornullif no implementation vendor exists.sealBase- The seal base URL ornullif the package should not be sealed.- Returns:
- The defined package.
-
-