@Test public void testHasAnnotationDeep() { assertThat(AssertUtils.hasAnnotationDeep(Class1.class, MetaAnno2.class)).isTrue(); assertThat(AssertUtils.hasAnnotationDeep(Class1.class, MetaAnno1.class)).isTrue(); assertThat(AssertUtils.hasAnnotationDeep(Class1.class, Anno1.class)).isTrue(); assertThat(AssertUtils.hasAnnotationDeep(Class2.class, Anno2.class)).isTrue(); assertThat(AssertUtils.hasAnnotationDeep(Class2.class, MetaAnno2.class)).isTrue(); }
public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate) { if (memberDeclaringClass.equals(candidate)) { return true; } for (Annotation anno : memberDeclaringClass.getAnnotations()) { Class<? extends Annotation> annoClass = anno.annotationType(); if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate)) { return true; } } return false; }
AssertUtils { public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate) { if (memberDeclaringClass.equals(candidate)) { return true; } for (Annotation anno : memberDeclaringClass.getAnnotations()) { Class<? extends Annotation> annoClass = anno.annotationType(); if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate)) { return true; } } return false; } }
AssertUtils { public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate) { if (memberDeclaringClass.equals(candidate)) { return true; } for (Annotation anno : memberDeclaringClass.getAnnotations()) { Class<? extends Annotation> annoClass = anno.annotationType(); if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate)) { return true; } } return false; }  }
AssertUtils { public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate) { if (memberDeclaringClass.equals(candidate)) { return true; } for (Annotation anno : memberDeclaringClass.getAnnotations()) { Class<? extends Annotation> annoClass = anno.annotationType(); if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate)) { return true; } } return false; }  static boolean isInterface(Class<? extends Object> candidate); static void assertInterface(Class<? extends Object> candidate); static boolean isClass(Class<? extends Object> candidate); static void assertIsClass(Class<? extends Object> candidate); static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate); static boolean hasAnnotationDeepRegex(Class<?> memberDeclaringClass, String metaAnnotationRegex); static boolean isEquivalent(Class<? extends Annotation> original, Class<? extends Annotation> copy); static A annotationProxyOf(Class<A> annotationModelType, Annotation annotationClone); static void assertionIllegalArgument(boolean asserted, String message); static void assertionNullPointer(boolean asserted, String message); static void assertLegal(Object underAssertion, String message); static void assertNotNull(Object underAssertion, String message); }
AssertUtils { public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate) { if (memberDeclaringClass.equals(candidate)) { return true; } for (Annotation anno : memberDeclaringClass.getAnnotations()) { Class<? extends Annotation> annoClass = anno.annotationType(); if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate)) { return true; } } return false; }  static boolean isInterface(Class<? extends Object> candidate); static void assertInterface(Class<? extends Object> candidate); static boolean isClass(Class<? extends Object> candidate); static void assertIsClass(Class<? extends Object> candidate); static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate); static boolean hasAnnotationDeepRegex(Class<?> memberDeclaringClass, String metaAnnotationRegex); static boolean isEquivalent(Class<? extends Annotation> original, Class<? extends Annotation> copy); static A annotationProxyOf(Class<A> annotationModelType, Annotation annotationClone); static void assertionIllegalArgument(boolean asserted, String message); static void assertionNullPointer(boolean asserted, String message); static void assertLegal(Object underAssertion, String message); static void assertNotNull(Object underAssertion, String message);  }