Package net.bytebuddy.dynamic.loading
Class ClassLoadingStrategy.Default.InjectionDispatcher
- java.lang.Object
-
- net.bytebuddy.dynamic.loading.ClassLoadingStrategy.Default.InjectionDispatcher
-
- All Implemented Interfaces:
ClassLoadingStrategy<java.lang.ClassLoader>
,ClassLoadingStrategy.Configurable<java.lang.ClassLoader>
- Enclosing class:
- ClassLoadingStrategy.Default
protected static class ClassLoadingStrategy.Default.InjectionDispatcher extends java.lang.Object implements ClassLoadingStrategy.Configurable<java.lang.ClassLoader>
A class loading strategy which applies a class loader injection while applying a givenProtectionDomain
on class injection.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.loading.ClassLoadingStrategy
ClassLoadingStrategy.Configurable<S extends java.lang.ClassLoader>, ClassLoadingStrategy.Default, ClassLoadingStrategy.ForBootstrapInjection, ClassLoadingStrategy.ForUnsafeInjection, ClassLoadingStrategy.UsingLookup
-
-
Field Summary
-
Fields inherited from interface net.bytebuddy.dynamic.loading.ClassLoadingStrategy
BOOTSTRAP_LOADER, NO_PROTECTION_DOMAIN
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InjectionDispatcher()
Creates a new injection dispatcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassLoadingStrategy.Configurable<java.lang.ClassLoader>
allowExistingTypes()
Determines if this class loading strategy should not throw an exception when attempting to load a class that was already loaded.java.util.Map<TypeDescription,java.lang.Class<?>>
load(java.lang.ClassLoader classLoader, java.util.Map<TypeDescription,byte[]> types)
Loads a given collection of classes given their binary representation.ClassLoadingStrategy.Configurable<java.lang.ClassLoader>
with(java.security.ProtectionDomain protectionDomain)
Overrides the implicitly set defaultProtectionDomain
with an explicit one.ClassLoadingStrategy.Configurable<java.lang.ClassLoader>
with(PackageDefinitionStrategy packageDefinitionStrategy)
Defines the supplied package definition strategy to be used for defining packages.
-
-
-
Method Detail
-
load
public java.util.Map<TypeDescription,java.lang.Class<?>> load(java.lang.ClassLoader classLoader, java.util.Map<TypeDescription,byte[]> types)
Description copied from interface:ClassLoadingStrategy
Loads a given collection of classes given their binary representation.- Specified by:
load
in interfaceClassLoadingStrategy<java.lang.ClassLoader>
- Parameters:
classLoader
- The class loader to used for loading the classes.types
- Byte array representations of the types to be loaded mapped by their descriptions, where an iteration order defines an order in which they are supposed to be loaded, if relevant.- Returns:
- A collection of the loaded classes which will be initialized in the iteration order of the returned collection.
-
with
public ClassLoadingStrategy.Configurable<java.lang.ClassLoader> with(java.security.ProtectionDomain protectionDomain)
Description copied from interface:ClassLoadingStrategy.Configurable
Overrides the implicitly set defaultProtectionDomain
with an explicit one.- Specified by:
with
in interfaceClassLoadingStrategy.Configurable<java.lang.ClassLoader>
- Parameters:
protectionDomain
- The protection domain to apply.- Returns:
- This class loading strategy with an explicitly set
ProtectionDomain
.
-
with
public ClassLoadingStrategy.Configurable<java.lang.ClassLoader> with(PackageDefinitionStrategy packageDefinitionStrategy)
Description copied from interface:ClassLoadingStrategy.Configurable
Defines the supplied package definition strategy to be used for defining packages.- Specified by:
with
in interfaceClassLoadingStrategy.Configurable<java.lang.ClassLoader>
- Parameters:
packageDefinitionStrategy
- The package definer to be used.- Returns:
- A version of this class loading strategy that applies the supplied package definition strategy.
-
allowExistingTypes
public ClassLoadingStrategy.Configurable<java.lang.ClassLoader> allowExistingTypes()
Description copied from interface:ClassLoadingStrategy.Configurable
Determines if this class loading strategy should not throw an exception when attempting to load a class that was already loaded. In this case, the already loaded class is used instead of the generated class.- Specified by:
allowExistingTypes
in interfaceClassLoadingStrategy.Configurable<java.lang.ClassLoader>
- Returns:
- A version of this class loading strategy that does not throw an exception when a class is already loaded.
-
-