Class ClassInjector.UsingInstrumentation

  • All Implemented Interfaces:
    ClassInjector
    Enclosing interface:
    ClassInjector

    public static class ClassInjector.UsingInstrumentation
    extends java.lang.Object
    implements ClassInjector
    A class injector using a Instrumentation to append to either the boot classpath or the system class path.
    • Constructor Detail

      • UsingInstrumentation

        protected UsingInstrumentation​(java.io.File folder,
                                       ClassInjector.UsingInstrumentation.Target target,
                                       java.lang.instrument.Instrumentation instrumentation,
                                       RandomString randomString)
        Creates an instrumentation-based class injector.
        Parameters:
        folder - The folder to be used for storing jar files.
        target - A representation of the target path to which classes are to be appended.
        instrumentation - The instrumentation to use for appending to the class path or the boot path.
        randomString - The random string generator to use.
    • Method Detail

      • of

        public static ClassInjector of​(java.io.File folder,
                                       ClassInjector.UsingInstrumentation.Target target,
                                       java.lang.instrument.Instrumentation instrumentation)
        Creates an instrumentation-based class injector.
        Parameters:
        folder - The folder to be used for storing jar files.
        target - A representation of the target path to which classes are to be appended.
        instrumentation - The instrumentation to use for appending to the class path or the boot path.
        Returns:
        An appropriate class injector that applies instrumentation.
      • inject

        public java.util.Map<TypeDescription,​java.lang.Class<?>> inject​(java.util.Map<? extends TypeDescription,​byte[]> types)
        Description copied from interface: ClassInjector
        Injects the given types into the represented class loader.
        Specified by:
        inject in interface ClassInjector
        Parameters:
        types - The types to load via injection.
        Returns:
        The loaded types that were passed as arguments.