Package net.bytebuddy.agent
Enum ByteBuddyAgent.AgentProvider.ForByteBuddyAgent
- java.lang.Object
-
- java.lang.Enum<ByteBuddyAgent.AgentProvider.ForByteBuddyAgent>
-
- net.bytebuddy.agent.ByteBuddyAgent.AgentProvider.ForByteBuddyAgent
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ByteBuddyAgent.AgentProvider.ForByteBuddyAgent>
,ByteBuddyAgent.AgentProvider
- Enclosing interface:
- ByteBuddyAgent.AgentProvider
public static enum ByteBuddyAgent.AgentProvider.ForByteBuddyAgent extends java.lang.Enum<ByteBuddyAgent.AgentProvider.ForByteBuddyAgent> implements ByteBuddyAgent.AgentProvider
An agent provider for a temporary Byte Buddy agent.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.ByteBuddyAgent.AgentProvider
ByteBuddyAgent.AgentProvider.ForByteBuddyAgent, ByteBuddyAgent.AgentProvider.ForExistingAgent
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
The singleton instance.
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
AGENT_FILE_NAME
The default prefix of the Byte Buddy agent jar file.
-
Constructor Summary
Constructors Modifier Constructor Description private
ForByteBuddyAgent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.io.File
createJarFile()
Creates an agent jar file containing theInstaller
class.java.io.File
resolve()
Provides an agent jar file for attachment.private static java.io.File
trySelfResolve()
Attempts to resolve theInstaller
class from this jar file if it can be located.static ByteBuddyAgent.AgentProvider.ForByteBuddyAgent
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ByteBuddyAgent.AgentProvider.ForByteBuddyAgent[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final ByteBuddyAgent.AgentProvider.ForByteBuddyAgent INSTANCE
The singleton instance.
-
-
Field Detail
-
AGENT_FILE_NAME
private static final java.lang.String AGENT_FILE_NAME
The default prefix of the Byte Buddy agent jar file.- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static ByteBuddyAgent.AgentProvider.ForByteBuddyAgent[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ByteBuddyAgent.AgentProvider.ForByteBuddyAgent c : ByteBuddyAgent.AgentProvider.ForByteBuddyAgent.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ByteBuddyAgent.AgentProvider.ForByteBuddyAgent valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
trySelfResolve
private static java.io.File trySelfResolve() throws java.io.IOException
Attempts to resolve theInstaller
class from this jar file if it can be located. Doing so, it is possible to avoid the creation of a temporary jar file which can remain undeleted on Windows operating systems where the agent is linked by a class loader such thatFile.deleteOnExit()
does not have an effect.- Returns:
- This jar file's location or
null
if this jar file's location is inaccessible. - Throws:
java.io.IOException
- If an I/O exception occurs.
-
createJarFile
private static java.io.File createJarFile() throws java.io.IOException
Creates an agent jar file containing theInstaller
class.- Returns:
- The agent jar file.
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
resolve
public java.io.File resolve() throws java.io.IOException
Provides an agent jar file for attachment.- Specified by:
resolve
in interfaceByteBuddyAgent.AgentProvider
- Returns:
- The provided agent.
- Throws:
java.io.IOException
- If the agent cannot be written to disk.
-
-