net.bytebuddy.matcher.InheritedAnnotationMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of byte-buddy-dep Show documentation
Show all versions of byte-buddy-dep Show documentation
Byte Buddy is a Java library for creating Java classes at run time.
This artifact is a build of Byte Buddy with a remaining dependency onto ASM.
You should never depend on this module without repackaging Byte Buddy and ASM into your own namespace.
package net.bytebuddy.matcher;
import lombok.EqualsAndHashCode;
import net.bytebuddy.description.annotation.AnnotationList;
import net.bytebuddy.description.type.TypeDescription;
/**
* An element matcher that matches the list of inherited annotations of a type description.
*
* @param The actual matched type of this matcher.
*/
@EqualsAndHashCode(callSuper = false)
public class InheritedAnnotationMatcher extends ElementMatcher.Junction.AbstractBase {
/**
* The matcher to be applied to the provided annotation list.
*/
private final ElementMatcher super AnnotationList> matcher;
/**
* Creates a new matcher for the inherited annotations of a type description.
*
* @param matcher The matcher to be applied to the provided annotation list.
*/
public InheritedAnnotationMatcher(ElementMatcher super AnnotationList> matcher) {
this.matcher = matcher;
}
@Override
public boolean matches(T target) {
return matcher.matches(target.getInheritedAnnotations());
}
@Override
public String toString() {
return "inheritsAnnotations(" + matcher + ")";
}
}