All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testifyproject.bytebuddy.matcher.DeclaringAnnotationMatcher Maven / Gradle / Ivy

The newest version!
package org.testifyproject.bytebuddy.matcher;

import lombok.EqualsAndHashCode;
import org.testifyproject.bytebuddy.description.annotation.AnnotationSource;
import org.testifyproject.bytebuddy.description.annotation.AnnotationList;

/**
 * An element matcher that matches the list of annotations that are provided by an annotated element.
 *
 * @param  The actual matched type of this matcher.
 */
@EqualsAndHashCode(callSuper = false)
public class DeclaringAnnotationMatcher extends ElementMatcher.Junction.AbstractBase {

    /**
     * The matcher to be applied to the provided annotation list.
     */
    private final ElementMatcher matcher;

    /**
     * Creates a new matcher for the annotations of an annotated element.
     *
     * @param matcher The matcher to be applied to the provided annotation list.
     */
    public DeclaringAnnotationMatcher(ElementMatcher matcher) {
        this.matcher = matcher;
    }

    @Override
    public boolean matches(T target) {
        return matcher.matches(target.getDeclaredAnnotations());
    }

    @Override
    public String toString() {
        return "declaresAnnotations(" + matcher + ")";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy