Class Installer

java.lang.Object
net.bytebuddy.agent.Installer

public class Installer extends Object
An installer class which defined the hook-in methods that are required by the Java agent specification.
  • Field Details

    • NAME

      public static final String NAME
      The name of the Installer class that is stored in an obfuscated format which will not be relocated.
  • Method Details

    • getInstrumentation

      public static Instrumentation getInstrumentation()

      Returns the instrumentation that was loaded by the Byte Buddy agent. When a security manager is active, the RuntimePermission for getInstrumentation is required by the caller.

      Important: This method must only be invoked via the ClassLoader.getSystemClassLoader() where any Java agent is loaded. It is possible that two versions of this class exist for different class loaders.

      Returns:
      The instrumentation instance of the Byte Buddy agent.
    • premain

      public static void premain(String arguments, Instrumentation instrumentation)
      Allows the installation of this agent via a command line argument.
      Parameters:
      arguments - The unused agent arguments.
      instrumentation - The instrumentation instance.
    • agentmain

      public static void agentmain(String arguments, Instrumentation instrumentation)
      Allows the installation of this agent via the attach API.
      Parameters:
      arguments - The unused agent arguments.
      instrumentation - The instrumentation instance.