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
Fields Modifier and Type Field Description private ElementMatcher.Junction<? super java.util.List<? extends JavaConstant>>
argumentsMatcher
A matcher for an invokedynamic instruction's constant arguments.private ElementMatcher<? super JavaConstant.MethodHandle>
handleMatcher
A matcher for an invokedynamic bootstrap method.private ElementMatcher.Junction<? super java.lang.String>
nameMatcher
A matcher for an invokedynamic instruction's name.private ElementMatcher.Junction<? super JavaConstant.MethodType>
typeMatcher
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
Constructors Modifier Constructor Description protected
ForMatchedDynamicInvocation(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, boolean failIfNoMatch, MemberSubstitution.Replacement.Factory replacementFactory, ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super java.lang.String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super java.util.List<? extends JavaConstant>> argumentsMatcher)
Creates a member substitution for an invokedynamic instruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberSubstitution
replaceWith(MemberSubstitution.Substitution.Factory substitutionFactory)
Replaces any interaction with the supplied substitution.MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation
withArguments(ElementMatcher<? super java.util.List<? extends JavaConstant>> argumentsMatcher)
Reduces matched invokedynamic instructions to such instructions that is provided with constant arguments which are matched by the supplied matcher.MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation
withName(ElementMatcher<? super java.lang.String> nameMatcher)
Reduces matched invokedynamic instructions to such instructions that declare a name which is matched by the supplied matcher.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.-
Methods inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
replaceWith, replaceWith, replaceWith, replaceWith, replaceWithChain, replaceWithChain, replaceWithConstant, replaceWithField, replaceWithInstrumentedMethod, replaceWithMethod, replaceWithMethod, stub
-
-
-
-
Field Detail
-
handleMatcher
private final ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher
A matcher for an invokedynamic bootstrap method.
-
nameMatcher
private final ElementMatcher.Junction<? super java.lang.String> nameMatcher
A matcher for an invokedynamic instruction's name.
-
typeMatcher
private final ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher
A matcher for an invokedynamic instruction's result type.
-
argumentsMatcher
private final ElementMatcher.Junction<? super java.util.List<? extends JavaConstant>> argumentsMatcher
A matcher for an invokedynamic instruction's constant arguments.
-
-
Constructor Detail
-
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 java.lang.String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super java.util.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 Detail
-
withName
public MemberSubstitution.WithoutSpecification.ForMatchedDynamicInvocation withName(ElementMatcher<? super java.lang.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 java.util.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
public MemberSubstitution replaceWith(MemberSubstitution.Substitution.Factory substitutionFactory)
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.
-
-