/** * Matches any annotations by a given matcher on a type that declared these annotations or inherited them from its * super classes. * * @param matcher A matcher to apply onto the inherited annotations. * @param <T> The type of the matched object. * @return A matcher that matches any inherited annotation by a given matcher. */ public static <T extends TypeDescription> ElementMatcher.Junction<T> inheritsAnnotation(ElementMatcher<? super TypeDescription> matcher) { return hasAnnotation(annotationType(matcher)); }
/** * Matches if an annotation is of a given type. * * @param type The expected annotation type. * @param <T> The type of the matched object. * @return A matcher that matches the annotation's type for being equal to the given type. */ public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(Class<? extends Annotation> type) { return annotationType(TypeDescription.ForLoadedType.of(type)); }
/** * Matches if an annotation is of a given type. * * @param type The expected annotation type. * @param <T> The type of the matched object. * @return A matcher that matches the annotation's type for being equal to the given type. */ public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(TypeDescription type) { return annotationType(is(type)); }
/** * Matches an {@link AnnotationSource} for declared annotations. * This matcher does not match inherited annotations which only exist for classes. Use * {@link net.bytebuddy.matcher.ElementMatchers#inheritsAnnotation(net.bytebuddy.matcher.ElementMatcher)} * for matching inherited annotations. * * @param matcher The matcher to apply to any annotation's type found on the matched annotated element. * @param <T> The type of the matched object. * @return A matcher that validates that an annotated element is annotated with an annotation of a type * that matches the given {@code matcher}. */ public static <T extends AnnotationSource> ElementMatcher.Junction<T> isAnnotatedWith(ElementMatcher<? super TypeDescription> matcher) { return declaresAnnotation(annotationType(matcher)); }
AnnotationAppender.ForTypeAnnotations.VARIABLE_ON_INVOKEABLE, methodDescription.getTypeVariables()); for (AnnotationDescription annotation : methodDescription.getDeclaredAnnotations().filter(not(annotationType(nameStartsWith("jdk.internal."))))) { annotationAppender = annotationAppender.append(annotation, annotationValueFilter);
@Override public final boolean matches(final TypeDescription target) { return hasAnnotation(annotationType(annotation)).matches(target); } }
for(int i = 0; i < arr.length; i++){ if(includeMatcher == null){ includeMatcher = ElementMatchers.hasAnnotation(ElementMatchers.annotationType(ElementMatchers.<TypeDescription>named(arr[i]))); continue; includeMatcher = includeMatcher.or(ElementMatchers.hasAnnotation(ElementMatchers.annotationType(ElementMatchers.<TypeDescription>named(arr[i])))); String[] arr = hasAnnotationVal.split(","); for (int i = 0; i < arr.length; i++) { matcher = matcher.and(ElementMatchers.not(ElementMatchers.hasAnnotation(ElementMatchers.annotationType(ElementMatchers.<TypeDescription>named(arr[i])))));