FragmentAnnotations { @Nullable public static <A extends Annotation> A obtainAnnotationFrom( @NonNull final Class<A> classOfAnnotation, @NonNull final Class<?> fromClass, @Nullable final Class<?> maxSuperClass ) { final A annotation = fromClass.getAnnotation(classOfAnnotation); if (annotation != null) { return annotation; } else if (maxSuperClass != null) { final Class<?> parent = fromClass.getSuperclass(); if (parent != null && !parent.equals(maxSuperClass)) { return obtainAnnotationFrom(classOfAnnotation, parent, maxSuperClass); } } return null; } private  FragmentAnnotations(); static void setEnabled(final boolean enabled); static boolean isEnabled(); static void checkIfEnabledOrThrow(); @Nullable static A obtainAnnotationFrom(
			@NonNull final Class<A> classOfAnnotation,
			@NonNull final Class<?> fromClass,
			@Nullable final Class<?> maxSuperClass
	); static void iterateFields(@NonNull final FieldProcessor processor, @NonNull final Class<?> ofClass, @Nullable final Class<?> maxSuperClass);  }
@Test public void testObtainAnnotationFrom() { assertThat(FragmentAnnotations.obtainAnnotationFrom(ComponentAnnotation.class, AnnotatedComponent.class, null), is(notNullValue())); assertThat(FragmentAnnotations.obtainAnnotationFrom(ChildComponentAnnotation.class, ChildAnnotatedComponent.class, null), is(notNullValue())); assertThat(FragmentAnnotations.obtainAnnotationFrom(ComponentAnnotation.class, ChildAnnotatedComponent.class, null), is(nullValue())); }
@Test public void testObtainAnnotationFromWithMaxSuperClass() { assertThat(FragmentAnnotations.obtainAnnotationFrom(ComponentAnnotation.class, ChildAnnotatedComponent.class, BaseComponent.class), is(notNullValue())); assertThat(FragmentAnnotations.obtainAnnotationFrom(ComponentAnnotation.class, Component.class, BaseComponent.class), is(nullValue())); }
@Test public void testObtainAnnotationFromWithMaxSuperClassForClassWithoutSuper() { assertThat(FragmentAnnotations.obtainAnnotationFrom(ComponentAnnotation.class, Object.class, BaseComponent.class), is(nullValue())); }
@Test public void testObtainAnnotationFromNotAnnotatedComponent() { assertThat(FragmentAnnotations.obtainAnnotationFrom(ComponentAnnotation.class, Component.class, null), is(nullValue())); }