Package net.bytebuddy.asm
Class MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
net.bytebuddy.asm.MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation
- Enclosing class:
MemberSubstitution.WithoutSpecification
@Enhance
public static class MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation
extends MemberSubstitution.WithoutSpecification
A member substitution for an invokedynamic instruction.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
MemberSubstitution.WithoutSpecification.ForMatchedByteCodeElement, MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation, MemberSubstitution.WithoutSpecification.ForMatchedField, MemberSubstitution.WithoutSpecification.ForMatchedMethod
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ElementMatcher.Junction
<? super List<? extends JavaConstant>> A matcher for an invokedynamic instruction's constant arguments.private final ElementMatcher
<? super JavaConstant.MethodHandle> A matcher for an invokedynamic bootstrap method.private final ElementMatcher.Junction
<? super String> A matcher for an invokedynamic instruction's name.private final ElementMatcher.Junction
<? super JavaConstant.MethodType> A matcher for an invokedynamic instruction's result type.Fields inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
failIfNoMatch, methodGraphCompiler, replacementFactory, strict, typePoolResolver
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForMatchedDynamicInvocation
(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, boolean failIfNoMatch, MemberSubstitution.Replacement.Factory replacementFactory, ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super List<? extends JavaConstant>> argumentsMatcher) Creates a member substitution for an invokedynamic instruction. -
Method Summary
Modifier and TypeMethodDescriptionreplaceWith
(MemberSubstitution.Substitution.Factory substitutionFactory) Replaces any interaction with the supplied substitution.withArguments
(ElementMatcher<? super List<? extends JavaConstant>> argumentsMatcher) Reduces matched invokedynamic instructions to such instructions that is provided with constant arguments which are matched by the supplied matcher.withName
(ElementMatcher<? super String> nameMatcher) Reduces matched invokedynamic instructions to such instructions that declare a name which is matched by the supplied matcher.withType
(ElementMatcher<? super JavaConstant.MethodType> typeMatcher) Reduces matched invokedynamic instructions to such instructions that require a type which is matched by the supplied matcher.Methods inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
replaceWith, replaceWith, replaceWith, replaceWith, replaceWithChain, replaceWithChain, replaceWithConstant, replaceWithField, replaceWithInstrumentedMethod, replaceWithMethod, replaceWithMethod, stub
-
Field Details
-
handleMatcher
A matcher for an invokedynamic bootstrap method. -
nameMatcher
A matcher for an invokedynamic instruction's name. -
typeMatcher
A matcher for an invokedynamic instruction's result type. -
argumentsMatcher
A matcher for an invokedynamic instruction's constant arguments.
-
-
Constructor Details
-
ForMatchedDynamicInvocation
protected ForMatchedDynamicInvocation(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, boolean failIfNoMatch, MemberSubstitution.Replacement.Factory replacementFactory, ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super List<? extends JavaConstant>> argumentsMatcher) Creates a member substitution for an invokedynamic instruction.- Parameters:
methodGraphCompiler
- The method graph compiler to use.typePoolResolver
- The type pool resolver to use.strict
-true
if the method processing should be strict where an exception is raised if a member cannot be found.failIfNoMatch
-true
if the instrumentation should fail if applied to a method without match.replacementFactory
- The replacement factory to use for creating substitutions.handleMatcher
- A matcher for an invokedynamic bootstrap method.nameMatcher
- A matcher for an invokedynamic instruction's name.typeMatcher
- A matcher for an invokedynamic instruction's result type.argumentsMatcher
- A matcher for an invokedynamic instruction's constant arguments.
-
-
Method Details
-
withName
public MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation withName(ElementMatcher<? super String> nameMatcher) Reduces matched invokedynamic instructions to such instructions that declare a name which is matched by the supplied matcher.- Parameters:
nameMatcher
- A matcher for an invokedynamic instruction's name.- Returns:
- A member substitution for an invokedynamic instruction with a name that is matched by the given matcher.
-
withType
public MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation withType(ElementMatcher<? super JavaConstant.MethodType> typeMatcher) Reduces matched invokedynamic instructions to such instructions that require a type which is matched by the supplied matcher.- Parameters:
typeMatcher
- A matcher for an invokedynamic instruction's required type.- Returns:
- A member substitution for an invokedynamic instruction with a required type that is matched by the given matcher.
-
withArguments
public MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation withArguments(ElementMatcher<? super List<? extends JavaConstant>> argumentsMatcher) Reduces matched invokedynamic instructions to such instructions that is provided with constant arguments which are matched by the supplied matcher.- Parameters:
argumentsMatcher
- A matcher for an invokedynamic instruction's constant arguments.- Returns:
- A member substitution for an invokedynamic instruction with constant arguments that are matched by the given matcher.
-
replaceWith
Description copied from class:MemberSubstitution.WithoutSpecification
Replaces any interaction with the supplied substitution.- Specified by:
replaceWith
in classMemberSubstitution.WithoutSpecification
- Parameters:
substitutionFactory
- The substitution factory to use for creating the applied substitution.- Returns:
- A member substitution that replaces any matched byte code element with the supplied substitution.
-