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:
Serializable
,Comparable<AgentBuilder.LocationStrategy.ForClassLoader>
,java.lang.constant.Constable
,AgentBuilder.LocationStrategy
- Enclosing interface:
AgentBuilder.LocationStrategy
public static enum AgentBuilder.LocationStrategy.ForClassLoader
extends Enum<AgentBuilder.LocationStrategy.ForClassLoader>
implements AgentBuilder.LocationStrategy
A location strategy that locates class files by querying an instrumented type's
ClassLoader
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.LocationStrategy
AgentBuilder.LocationStrategy.Compound, AgentBuilder.LocationStrategy.ForClassLoader, AgentBuilder.LocationStrategy.NoOp, AgentBuilder.LocationStrategy.Simple
-
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the enum constant of this type with the specified name.values()
Returns an array containing the constants of this enum type, in the order they are declared.withFallbackTo
(Collection<? extends ClassFileLocator> classFileLocators) Adds additional location strategies as fallbacks to this location strategy.withFallbackTo
(List<? extends AgentBuilder.LocationStrategy> locationStrategies) Adds additional location strategies as fallbacks to this location strategy.withFallbackTo
(AgentBuilder.LocationStrategy... locationStrategy) Adds additional location strategies as fallbacks to this location strategy.withFallbackTo
(ClassFileLocator... classFileLocator) Adds additional location strategies as fallbacks to this location strategy.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface net.bytebuddy.agent.builder.AgentBuilder.LocationStrategy
classFileLocator
-
Enum Constant Details
-
STRONG
A location strategy that keeps a strong reference to the class loader the created class file locator represents. -
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.
-
-
Constructor Details
-
ForClassLoader
private ForClassLoader()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
withFallbackTo
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(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(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.
-