Package net.bytebuddy.agent.builder
Class AgentBuilder.Default.NativeMethodStrategy.ForPrefix
- java.lang.Object
-
- net.bytebuddy.agent.builder.AgentBuilder.Default.NativeMethodStrategy.ForPrefix
-
- All Implemented Interfaces:
AgentBuilder.Default.NativeMethodStrategy
- Enclosing interface:
- AgentBuilder.Default.NativeMethodStrategy
@Enhance public static class AgentBuilder.Default.NativeMethodStrategy.ForPrefix extends java.lang.Object implements AgentBuilder.Default.NativeMethodStrategy
A native method strategy that prefixes method names with a fixed value for supporting rebasing of native methods.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.Default.NativeMethodStrategy
AgentBuilder.Default.NativeMethodStrategy.Disabled, AgentBuilder.Default.NativeMethodStrategy.ForPrefix
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
prefix
The method name prefix.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForPrefix(java.lang.String prefix)
Creates a new name prefixing native method strategy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getPrefix()
Returns the method prefix if the strategy is enabled.boolean
isEnabled(java.lang.instrument.Instrumentation instrumentation)
Determines if this strategy enables name prefixing for native methods.protected static AgentBuilder.Default.NativeMethodStrategy
of(java.lang.String prefix)
Creates a new native method strategy for prefixing method names.MethodNameTransformer
resolve()
Resolves the method name transformer for this strategy.
-
-
-
Method Detail
-
of
protected static AgentBuilder.Default.NativeMethodStrategy of(java.lang.String prefix)
Creates a new native method strategy for prefixing method names.- Parameters:
prefix
- The method name prefix.- Returns:
- An appropriate native method strategy.
-
resolve
public MethodNameTransformer resolve()
Resolves the method name transformer for this strategy.- Specified by:
resolve
in interfaceAgentBuilder.Default.NativeMethodStrategy
- Returns:
- A method name transformer for this strategy.
-
isEnabled
public boolean isEnabled(java.lang.instrument.Instrumentation instrumentation)
Determines if this strategy enables name prefixing for native methods.- Specified by:
isEnabled
in interfaceAgentBuilder.Default.NativeMethodStrategy
- Parameters:
instrumentation
- The instrumentation used.- Returns:
true
if this strategy indicates that a native method prefix should be used.
-
getPrefix
public java.lang.String getPrefix()
Returns the method prefix if the strategy is enabled. This method must only be called if this strategy enables prefixing.- Specified by:
getPrefix
in interfaceAgentBuilder.Default.NativeMethodStrategy
- Returns:
- The method prefix.
-
-