org.testifyproject.bytebuddy.matcher.InheritedAnnotationMatcher Maven / Gradle / Ivy
The newest version!
package org.testifyproject.bytebuddy.matcher;
import lombok.EqualsAndHashCode;
import org.testifyproject.bytebuddy.description.annotation.AnnotationList;
import org.testifyproject.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 + ")";
}
}