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 aTypeDescription
and itsClassLoader
against 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>
classLoaderMatcher
The class loader matcher to apply to aClassLoader
.private ElementMatcher<? super JavaModule>
moduleMatcher
A module matcher to apply to ajava.lang.Module
.private ElementMatcher<? super TypeDescription>
typeMatcher
The type matcher to apply to aTypeDescription
.
-
Constructor Summary
Constructors Constructor Description ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher)
Creates a newAgentBuilder.RawMatcher
that only matches the suppliedTypeDescription
against a supplied matcher.ForElementMatchers(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super java.lang.ClassLoader> classLoaderMatcher)
Creates a newAgentBuilder.RawMatcher
that only matches the suppliedTypeDescription
and itsClassLoader
against 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.RawMatcher
that only matches the suppliedTypeDescription
, itsClassLoader
and module against element suitable matchers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
matches(TypeDescription typeDescription, java.lang.ClassLoader classLoader, JavaModule module, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain)
Decides if the giventypeDescription
should be instrumented with the entailedAgentBuilder.Transformer
s.
-
-
-
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.RawMatcher
that only matches the suppliedTypeDescription
against 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.RawMatcher
that only matches the suppliedTypeDescription
and itsClassLoader
against 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.RawMatcher
that only matches the suppliedTypeDescription
, itsClassLoader
and 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, java.lang.ClassLoader classLoader, JavaModule module, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain)
Decides if the giventypeDescription
should be instrumented with the entailedAgentBuilder.Transformer
s.- Specified by:
matches
in interfaceAgentBuilder.RawMatcher
- Parameters:
typeDescription
- A description of the type to be instrumented.classLoader
- The class loader of the instrumented type. Might benull
if this class loader represents the bootstrap class loader.module
- The transformed type's module ornull
if the current VM does not support modules.classBeingRedefined
- The class being redefined which is only notnull
if a retransformation is applied.protectionDomain
- The protection domain of the type being transformed.- Returns:
true
if the entailedAgentBuilder.Transformer
s should be applied for the giventypeDescription
.
-
-