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.StringprefixThe method name prefix.
-
Constructor Summary
Constructors Modifier Constructor Description protectedForPrefix(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.StringgetPrefix()Returns the method prefix if the strategy is enabled.booleanisEnabled(java.lang.instrument.Instrumentation instrumentation)Determines if this strategy enables name prefixing for native methods.protected static AgentBuilder.Default.NativeMethodStrategyof(java.lang.String prefix)Creates a new native method strategy for prefixing method names.MethodNameTransformerresolve()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:
resolvein 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:
isEnabledin interfaceAgentBuilder.Default.NativeMethodStrategy- Parameters:
instrumentation- The instrumentation used.- Returns:
trueif 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:
getPrefixin interfaceAgentBuilder.Default.NativeMethodStrategy- Returns:
- The method prefix.
-
-