Package net.bytebuddy.dynamic
Class DynamicType.Default.Unloaded<T>
java.lang.Object
net.bytebuddy.dynamic.DynamicType.AbstractBase
net.bytebuddy.dynamic.DynamicType.Default
net.bytebuddy.dynamic.DynamicType.Default.Unloaded<T>
- Type Parameters:
T
- The most specific known loaded type that is implemented by this dynamic type, usually the type itself, an interface or the direct super class.
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClassFileLocator
,DynamicType
,DynamicType.Unloaded<T>
- Enclosing class:
DynamicType.Default
@Enhance
public static class DynamicType.Default.Unloaded<T>
extends DynamicType.Default
implements DynamicType.Unloaded<T>
A default implementation of an unloaded dynamic type.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.dynamic.DynamicType.Default
DynamicType.Default.Loaded<T>, DynamicType.Default.Unloaded<T>
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.ClassFileLocator
ClassFileLocator.Compound, ClassFileLocator.Filtering, ClassFileLocator.ForClassLoader, ClassFileLocator.ForFolder, ClassFileLocator.ForInstrumentation, ClassFileLocator.ForJarFile, ClassFileLocator.ForModule, ClassFileLocator.ForModuleFile, ClassFileLocator.ForUrl, ClassFileLocator.MultiReleaseAware, ClassFileLocator.NoOp, ClassFileLocator.PackageDiscriminating, ClassFileLocator.Resolution, ClassFileLocator.Simple
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.DynamicType
DynamicType.AbstractBase, DynamicType.Builder<T>, DynamicType.Default, DynamicType.Loaded<T>, DynamicType.Unloaded<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeResolutionStrategy.Resolved
The type resolution strategy to use for initializing the dynamic type.Fields inherited from class net.bytebuddy.dynamic.DynamicType.Default
auxiliaryTypes, binaryRepresentation, loadedTypeInitializer, typeDescription
Fields inherited from interface net.bytebuddy.dynamic.ClassFileLocator
CLASS_FILE_EXTENSION, META_INF_VERSIONS
-
Constructor Summary
ConstructorsConstructorDescriptionUnloaded
(TypeDescription typeDescription, byte[] binaryRepresentation, LoadedTypeInitializer loadedTypeInitializer, List<? extends DynamicType> auxiliaryTypes, TypeResolutionStrategy.Resolved typeResolutionStrategy) Creates a new unloaded representation of a dynamic type. -
Method Summary
Modifier and TypeMethodDescriptioninclude
(List<? extends DynamicType> dynamicType) Includes the provided dynamic types as auxiliary types of this instance.include
(DynamicType... dynamicType) Includes the provided dynamic types as auxiliary types of this instance.load
(ClassLoader classLoader) Attempts to load this dynamic type including all of its auxiliary types, if any.<S extends ClassLoader>
DynamicType.Loaded<T> load
(S classLoader, ClassLoadingStrategy<? super S> classLoadingStrategy) Attempts to load this dynamic type including all of its auxiliary types, if any.Methods inherited from class net.bytebuddy.dynamic.DynamicType.Default
getAuxiliaries, getBytes, getLoadedTypeInitializer, getTypeDescription
Methods inherited from class net.bytebuddy.dynamic.DynamicType.AbstractBase
close, getAllTypeDescriptions, getAllTypes, getAuxiliaryTypeDescriptions, getAuxiliaryTypes, getLoadedTypeInitializers, hasAliveLoadedTypeInitializers, inject, inject, locate, saveIn, toJar, toJar
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.bytebuddy.dynamic.ClassFileLocator
locate
Methods inherited from interface net.bytebuddy.dynamic.DynamicType
close, getAllTypeDescriptions, getAllTypes, getAuxiliaries, getAuxiliaryTypeDescriptions, getAuxiliaryTypes, getBytes, getLoadedTypeInitializer, getLoadedTypeInitializers, getTypeDescription, hasAliveLoadedTypeInitializers, inject, inject, saveIn, toJar, toJar
-
Field Details
-
typeResolutionStrategy
The type resolution strategy to use for initializing the dynamic type.
-
-
Constructor Details
-
Unloaded
public Unloaded(TypeDescription typeDescription, byte[] binaryRepresentation, LoadedTypeInitializer loadedTypeInitializer, List<? extends DynamicType> auxiliaryTypes, TypeResolutionStrategy.Resolved typeResolutionStrategy) Creates a new unloaded representation of a dynamic type.- Parameters:
typeDescription
- A description of this dynamic type.binaryRepresentation
- An array of byte of the binary representation of this dynamic type.loadedTypeInitializer
- The type initializer of this dynamic type.auxiliaryTypes
- The auxiliary types that are required for this dynamic type.typeResolutionStrategy
- The type resolution strategy to use for initializing the dynamic type.
-
-
Method Details
-
load
Attempts to load this dynamic type including all of its auxiliary types, if any. If the class loader is an unsealed instance of
InjectionClassLoader
, the classes are injected directy into the class loader, otherwise, a new class loader is created where the supplied class loader is set as parent.Note: A new class is attempted to be loaded each time this method is invoked, even if a compatible class was created previously. Consider using a
TypeCache
.- Specified by:
load
in interfaceDynamicType.Unloaded<T>
- Parameters:
classLoader
- The class loader to use for this class loading ornull
for using the boot loader.- Returns:
- This dynamic type in its loaded state.
-
load
public <S extends ClassLoader> DynamicType.Loaded<T> load(@MaybeNull S classLoader, ClassLoadingStrategy<? super S> classLoadingStrategy) Attempts to load this dynamic type including all of its auxiliary types, if any.
Note: A new class is attempted to be loaded each time this method is invoked, even if a compatible class was created previously. Consider using a
TypeCache
.- Specified by:
load
in interfaceDynamicType.Unloaded<T>
- Type Parameters:
S
- The least specific type of class loader this strategy can apply to.- Parameters:
classLoader
- The class loader to use for this class loading.classLoadingStrategy
- The class loader strategy which should be used for this class loading.- Returns:
- This dynamic type in its loaded state.
- See Also:
-
include
Includes the provided dynamic types as auxiliary types of this instance.- Specified by:
include
in interfaceDynamicType.Unloaded<T>
- Parameters:
dynamicType
- The dynamic types to include.- Returns:
- A copy of this unloaded dynamic type which includes the provided dynamic types.
-
include
Includes the provided dynamic types as auxiliary types of this instance.- Specified by:
include
in interfaceDynamicType.Unloaded<T>
- Parameters:
dynamicType
- The dynamic types to include.- Returns:
- A copy of this unloaded dynamic type which includes the provided dynamic types.
-