Top Description Fields Constructors Methods
net.bytebuddy.agent

public Class Installer

extends Object
Class Inheritance
Imports
net.bytebuddy.agent.utility.nullability.MaybeNull, java.lang.instrument.Instrumentation, java.lang.reflect.InvocationTargetException, java.security.Permission

An installer class which defined the hook-in methods that are required by the Java agent specification.

Field Summary

Modifier and TypeField and Description
private static volatile Instrumentation
instrumentation

A field for carrying the java.lang.instrument.Instrumentation that was loaded by the Byte Buddy agent.

Constructor Summary

AccessConstructor and Description
private
Installer()

The installer provides only static hook-in methods and should not be instantiated.

Method Summary

Modifier and TypeMethod and Description
public static void
agentmain(String
The unused agent arguments.
arguments
,
Instrumentation
The instrumentation instance.
instrumentation
)

Allows the installation of this agent via the attach API.

public static Instrumentation

Returns:

The instrumentation instance of the Byte Buddy agent.
getInstrumentation
()

Returns the instrumentation that was loaded by the Byte Buddy agent.

public static void
premain(String
The unused agent arguments.
arguments
,
Instrumentation
The instrumentation instance.
instrumentation
)

Allows the installation of this agent via a command line argument.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

instrumentationback to summary
private static volatile Instrumentation instrumentation

A field for carrying the java.lang.instrument.Instrumentation that was loaded by the Byte Buddy agent. Note that this field must never be accessed directly as the agent is injected into the VM's system class loader. This way, the field of this class might be null even after the installation of the Byte Buddy agent as this class might be loaded by a different class loader than the system class loader.

Annotations
@MaybeNull

Constructor Detail

Installerback to summary
private Installer()

The installer provides only static hook-in methods and should not be instantiated.

Method Detail

agentmainback to summary
public static void agentmain(String arguments, Instrumentation instrumentation)

Allows the installation of this agent via the attach API.

Parameters
arguments:String

The unused agent arguments.

instrumentation:Instrumentation

The instrumentation instance.

getInstrumentationback to summary
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 Note

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:Instrumentation

The instrumentation instance of the Byte Buddy agent.

premainback to summary
public static void premain(String arguments, Instrumentation instrumentation)

Allows the installation of this agent via a command line argument.

Parameters
arguments:String

The unused agent arguments.

instrumentation:Instrumentation

The instrumentation instance.