Package net.bytebuddy.matcher
Class MethodOverrideMatcher<T extends MethodDescription>
java.lang.Object
net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase<T>
net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues<T>
net.bytebuddy.matcher.MethodOverrideMatcher<T>
- Type Parameters:
T
- The type of the matched entity.
- All Implemented Interfaces:
ElementMatcher<T>
,ElementMatcher.Junction<T>
@Enhance
public class MethodOverrideMatcher<T extends MethodDescription>
extends ElementMatcher.Junction.ForNonNullValues<T>
A matcher that checks if any super type of a type declares a method with the same shape of a matched method.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher
ElementMatcher.Junction<S>
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher.Junction
ElementMatcher.Junction.AbstractBase<V>, ElementMatcher.Junction.Conjunction<W>, ElementMatcher.Junction.Disjunction<W>, ElementMatcher.Junction.ForNonNullValues<W>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ElementMatcher
<? super TypeDescription.Generic> The matcher that is to be applied to the type that declares a method of the same shape. -
Constructor Summary
ConstructorsConstructorDescriptionMethodOverrideMatcher
(ElementMatcher<? super TypeDescription.Generic> matcher) Creates a new method override matcher. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Matches the supplied value if it was found not to benull
.private boolean
matches
(MethodDescription target, List<? extends TypeDefinition> typeDefinitions, Set<TypeDescription> duplicates) Matches a method against a list of types.private boolean
matches
(MethodDescription target, TypeDefinition typeDefinition) Checks if a type declares a method with the same signature astarget
.toString()
Methods inherited from class net.bytebuddy.matcher.ElementMatcher.Junction.ForNonNullValues
matches
Methods inherited from class net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase
and, or
-
Field Details
-
matcher
The matcher that is to be applied to the type that declares a method of the same shape.
-
-
Constructor Details
-
MethodOverrideMatcher
Creates a new method override matcher.- Parameters:
matcher
- The matcher that is to be applied to the type that declares a method of the same shape.
-
-
Method Details
-
doMatch
Matches the supplied value if it was found not to benull
.- Specified by:
doMatch
in classElementMatcher.Junction.ForNonNullValues<T extends MethodDescription>
- Parameters:
target
- The instance to be matched.- Returns:
true
if the given element is matched by this matcher orfalse
otherwise.
-
matches
private boolean matches(MethodDescription target, List<? extends TypeDefinition> typeDefinitions, Set<TypeDescription> duplicates) Matches a method against a list of types.- Parameters:
target
- The method that is matched as a target.typeDefinitions
- The type definitions to check if they declare a method with the same signature astarget
.duplicates
- A set containing duplicate interfaces that do not need to be revisited.- Returns:
true
if any type defines a method with the same signature as thetarget
method.
-
matches
Checks if a type declares a method with the same signature astarget
.- Parameters:
target
- The method to be checked.typeDefinition
- The type to check for declaring a method with the same signature astarget
.- Returns:
true
if the supplied type declares a compatible method.
-
toString
-