Package net.bytebuddy.agent.builder
Class AgentBuilder.RawMatcher.ForElementMatchers
- java.lang.Object
-
- net.bytebuddy.agent.builder.AgentBuilder.RawMatcher.ForElementMatchers
-
- All Implemented Interfaces:
AgentBuilder.RawMatcher
- Enclosing interface:
- AgentBuilder.RawMatcher
@Enhance public static class AgentBuilder.RawMatcher.ForElementMatchers extends java.lang.Object implements AgentBuilder.RawMatcher
A raw matcher implementation that checks aTypeDescriptionand itsClassLoaderagainst two suitable matchers in order to determine if the matched type should be instrumented.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.RawMatcher
AgentBuilder.RawMatcher.Conjunction, AgentBuilder.RawMatcher.Disjunction, AgentBuilder.RawMatcher.ForElementMatchers, AgentBuilder.RawMatcher.ForLoadState, AgentBuilder.RawMatcher.ForResolvableTypes, AgentBuilder.RawMatcher.Inversion, AgentBuilder.RawMatcher.Trivial
-
-
Field Summary
Fields Modifier and Type Field Description private ElementMatcher<? super java.lang.ClassLoader>classLoaderMatcherThe class loader matcher to apply to aClassLoader.private ElementMatcher<? super JavaModule>moduleMatcherA module matcher to apply to ajava.lang.Module.private ElementMatcher<? super TypeDescription>typeMatcherThe type matcher to apply to aTypeDescription.
-
Constructor Summary
Constructors Constructor Description ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher)Creates a newAgentBuilder.RawMatcherthat only matches the suppliedTypeDescriptionagainst a supplied matcher.ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderMatcher)Creates a newAgentBuilder.RawMatcherthat only matches the suppliedTypeDescriptionand itsClassLoaderagainst two matcher in order to decided if an instrumentation should be conducted.ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderMatcher, ElementMatcher<? super JavaModule> moduleMatcher)Creates a newAgentBuilder.RawMatcherthat only matches the suppliedTypeDescription, itsClassLoaderand module against element suitable matchers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanmatches(TypeDescription typeDescription, java.lang.ClassLoader classLoader, JavaModule module, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain)Decides if the giventypeDescriptionshould be instrumented with the entailedAgentBuilder.Transformers.
-
-
-
Field Detail
-
typeMatcher
private final ElementMatcher<? super TypeDescription> typeMatcher
The type matcher to apply to aTypeDescription.
-
classLoaderMatcher
private final ElementMatcher<? super java.lang.ClassLoader> classLoaderMatcher
The class loader matcher to apply to aClassLoader.
-
moduleMatcher
private final ElementMatcher<? super JavaModule> moduleMatcher
A module matcher to apply to ajava.lang.Module.
-
-
Constructor Detail
-
ForElementMatchers
public ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher)
Creates a newAgentBuilder.RawMatcherthat only matches the suppliedTypeDescriptionagainst a supplied matcher.- Parameters:
typeMatcher- The type matcher to apply to aTypeDescription.
-
ForElementMatchers
public ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderMatcher)
Creates a newAgentBuilder.RawMatcherthat only matches the suppliedTypeDescriptionand itsClassLoaderagainst two matcher in order to decided if an instrumentation should be conducted.- Parameters:
typeMatcher- The type matcher to apply to aTypeDescription.classLoaderMatcher- The class loader matcher to apply to aClassLoader.
-
ForElementMatchers
public ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderMatcher, ElementMatcher<? super JavaModule> moduleMatcher)
Creates a newAgentBuilder.RawMatcherthat only matches the suppliedTypeDescription, itsClassLoaderand module against element suitable matchers.- Parameters:
typeMatcher- The type matcher to apply to aTypeDescription.classLoaderMatcher- The class loader matcher to apply to aClassLoader.moduleMatcher- A module matcher to apply to ajava.lang.Module.
-
-
Method Detail
-
matches
public boolean matches(TypeDescription typeDescription, @MaybeNull java.lang.ClassLoader classLoader, @MaybeNull JavaModule module, @MaybeNull java.lang.Class<?> classBeingRedefined, @MaybeNull java.security.ProtectionDomain protectionDomain)
Decides if the giventypeDescriptionshould be instrumented with the entailedAgentBuilder.Transformers.- Specified by:
matchesin interfaceAgentBuilder.RawMatcher- Parameters:
typeDescription- A description of the type to be instrumented.classLoader- The class loader of the instrumented type. Might benullif this class loader represents the bootstrap class loader.module- The transformed type's module ornullif the current VM does not support modules.classBeingRedefined- The class being redefined which is only notnullif a retransformation is applied.protectionDomain- The protection domain of the type being transformed ornullif none is available.- Returns:
trueif the entailedAgentBuilder.Transformers should be applied for the giventypeDescription.
-
-