Class 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.
  • Field Details

    • typeResolutionStrategy

      private final TypeResolutionStrategy.Resolved 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

      public DynamicType.Loaded<T> load(@MaybeNull ClassLoader classLoader)

      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 interface DynamicType.Unloaded<T>
      Parameters:
      classLoader - The class loader to use for this class loading or null 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 interface DynamicType.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

      public DynamicType.Unloaded<T> include(DynamicType... dynamicType)
      Includes the provided dynamic types as auxiliary types of this instance.
      Specified by:
      include in interface DynamicType.Unloaded<T>
      Parameters:
      dynamicType - The dynamic types to include.
      Returns:
      A copy of this unloaded dynamic type which includes the provided dynamic types.
    • include

      public DynamicType.Unloaded<T> include(List<? extends DynamicType> dynamicType)
      Includes the provided dynamic types as auxiliary types of this instance.
      Specified by:
      include in interface DynamicType.Unloaded<T>
      Parameters:
      dynamicType - The dynamic types to include.
      Returns:
      A copy of this unloaded dynamic type which includes the provided dynamic types.