Package net.bytebuddy.matcher
Class MethodOverrideMatcher<T extends MethodDescription>
- java.lang.Object
-
- net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase<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.AbstractBase<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>
-
-
Field Summary
Fields Modifier and Type Field Description private ElementMatcher<? super TypeDescription.Generic>matcherThe matcher that is to be applied to the type that declares a method of the same shape.
-
Constructor Summary
Constructors Constructor Description MethodOverrideMatcher(ElementMatcher<? super TypeDescription.Generic> matcher)Creates a new method override matcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanmatches(MethodDescription target, java.util.List<? extends TypeDefinition> typeDefinitions, java.util.Set<TypeDescription> duplicates)Matches a method against a list of types.private booleanmatches(MethodDescription target, TypeDefinition typeDefinition)Checks if a type declares a method with the same signature astarget.booleanmatches(T target)Matches a target against this element matcher.java.lang.StringtoString()-
Methods inherited from class net.bytebuddy.matcher.ElementMatcher.Junction.AbstractBase
and, or
-
-
-
-
Field Detail
-
matcher
private final ElementMatcher<? super TypeDescription.Generic> matcher
The matcher that is to be applied to the type that declares a method of the same shape.
-
-
Constructor Detail
-
MethodOverrideMatcher
public MethodOverrideMatcher(ElementMatcher<? super TypeDescription.Generic> matcher)
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 Detail
-
matches
public boolean matches(T target)
Matches a target against this element matcher.- Parameters:
target- The instance to be matched.- Returns:
trueif the given element is matched by this matcher orfalseotherwise.
-
matches
private boolean matches(MethodDescription target, java.util.List<? extends TypeDefinition> typeDefinitions, java.util.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:
trueif any type defines a method with the same signature as thetargetmethod.
-
matches
private boolean matches(MethodDescription target, TypeDefinition typeDefinition)
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:
trueif the supplied type declares a compatible method.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-