Package net.bytebuddy.agent.builder
Enum AgentBuilder.LocationStrategy.ForClassLoader
- java.lang.Object
-
- java.lang.Enum<AgentBuilder.LocationStrategy.ForClassLoader>
-
- net.bytebuddy.agent.builder.AgentBuilder.LocationStrategy.ForClassLoader
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<AgentBuilder.LocationStrategy.ForClassLoader>
,AgentBuilder.LocationStrategy
- Enclosing interface:
- AgentBuilder.LocationStrategy
public static enum AgentBuilder.LocationStrategy.ForClassLoader extends java.lang.Enum<AgentBuilder.LocationStrategy.ForClassLoader> implements AgentBuilder.LocationStrategy
A location strategy that locates class files by querying an instrumented type'sClassLoader
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.LocationStrategy
AgentBuilder.LocationStrategy.Compound, AgentBuilder.LocationStrategy.ForClassLoader, AgentBuilder.LocationStrategy.NoOp, AgentBuilder.LocationStrategy.Simple
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ForClassLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AgentBuilder.LocationStrategy.ForClassLoader
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static AgentBuilder.LocationStrategy.ForClassLoader[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.AgentBuilder.LocationStrategy
withFallbackTo(java.util.Collection<? extends ClassFileLocator> classFileLocators)
Adds additional location strategies as fallbacks to this location strategy.AgentBuilder.LocationStrategy
withFallbackTo(java.util.List<? extends AgentBuilder.LocationStrategy> locationStrategies)
Adds additional location strategies as fallbacks to this location strategy.AgentBuilder.LocationStrategy
withFallbackTo(AgentBuilder.LocationStrategy... locationStrategy)
Adds additional location strategies as fallbacks to this location strategy.AgentBuilder.LocationStrategy
withFallbackTo(ClassFileLocator... classFileLocator)
Adds additional location strategies as fallbacks to this location strategy.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface net.bytebuddy.agent.builder.AgentBuilder.LocationStrategy
classFileLocator
-
-
-
-
Enum Constant Detail
-
STRONG
public static final AgentBuilder.LocationStrategy.ForClassLoader STRONG
A location strategy that keeps a strong reference to the class loader the created class file locator represents.
-
WEAK
public static final AgentBuilder.LocationStrategy.ForClassLoader WEAK
A location strategy that keeps a weak reference to the class loader the created class file locator represents. As a consequence, any returned class file locator stops working once the represented class loader is garbage collected.
-
-
Method Detail
-
values
public static AgentBuilder.LocationStrategy.ForClassLoader[] 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 (AgentBuilder.LocationStrategy.ForClassLoader c : AgentBuilder.LocationStrategy.ForClassLoader.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AgentBuilder.LocationStrategy.ForClassLoader 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
-
withFallbackTo
public AgentBuilder.LocationStrategy withFallbackTo(ClassFileLocator... classFileLocator)
Adds additional location strategies as fallbacks to this location strategy.- Parameters:
classFileLocator
- The class file locators to query if this location strategy cannot locate a class file.- Returns:
- A compound location strategy that first applies this location strategy and then queries the supplied class file locators.
-
withFallbackTo
public AgentBuilder.LocationStrategy withFallbackTo(java.util.Collection<? extends ClassFileLocator> classFileLocators)
Adds additional location strategies as fallbacks to this location strategy.- Parameters:
classFileLocators
- The class file locators to query if this location strategy cannot locate a class file.- Returns:
- A compound location strategy that first applies this location strategy and then queries the supplied class file locators.
-
withFallbackTo
public AgentBuilder.LocationStrategy withFallbackTo(AgentBuilder.LocationStrategy... locationStrategy)
Adds additional location strategies as fallbacks to this location strategy.- Parameters:
locationStrategy
- The fallback location strategies to use.- Returns:
- A compound location strategy that first applies this location strategy and then the supplied fallback location strategies in the supplied order.
-
withFallbackTo
public AgentBuilder.LocationStrategy withFallbackTo(java.util.List<? extends AgentBuilder.LocationStrategy> locationStrategies)
Adds additional location strategies as fallbacks to this location strategy.- Parameters:
locationStrategies
- The fallback location strategies to use.- Returns:
- A compound location strategy that first applies this location strategy and then the supplied fallback location strategies in the supplied order.
-
-