Class Installer


  • public class Installer
    extends java.lang.Object
    An installer class which defined the hook-in methods that are required by the Java agent specification.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void agentmain​(java.lang.String agentArguments, java.lang.instrument.Instrumentation instrumentation)
      Allows the installation of this agent via the Attach API.
      static java.lang.instrument.Instrumentation getInstrumentation()
      Returns the instrumentation that was loaded by the Byte Buddy agent.
      static void premain​(java.lang.String agentArguments, java.lang.instrument.Instrumentation instrumentation)
      Allows the installation of this agent via a command line argument.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstrumentation

        public static java.lang.instrument.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​(java.lang.String agentArguments,
                                   java.lang.instrument.Instrumentation instrumentation)
        Allows the installation of this agent via a command line argument.
        Parameters:
        agentArguments - The unused agent arguments.
        instrumentation - The instrumentation instance.
      • agentmain

        public static void agentmain​(java.lang.String agentArguments,
                                     java.lang.instrument.Instrumentation instrumentation)
        Allows the installation of this agent via the Attach API.
        Parameters:
        agentArguments - The unused agent arguments.
        instrumentation - The instrumentation instance.