Interface SubclassLoader

All Known Implementing Classes:
SubclassInjectionLoader, SubclassInjectionLoader.WithLookup, SubclassInjectionLoader.WithReflection

public interface SubclassLoader
A subclass loader is responsible for resolving a class loading strategy for a mock that is implemented as a subclass.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this loader does not require a module to be open.
    net.bytebuddy.dynamic.loading.ClassLoadingStrategy<ClassLoader>
    resolveStrategy(Class<?> mockedType, ClassLoader classLoader, boolean localMock)
    Resolves a class loading strategy.
  • Method Details

    • isDisrespectingOpenness

      boolean isDisrespectingOpenness()
      Checks if this loader does not require a module to be open.
      Returns:
      true if this loader is not constraint to a target module being opened for loading a class.
    • resolveStrategy

      net.bytebuddy.dynamic.loading.ClassLoadingStrategy<ClassLoader> resolveStrategy(Class<?> mockedType, ClassLoader classLoader, boolean localMock)
      Resolves a class loading strategy.
      Parameters:
      mockedType - The type being mocked.
      classLoader - The class loader being used.
      localMock - true if the mock is loaded within the runtime package of the mocked type.
      Returns:
      An appropriate class loading strategy.