@Test public void testGetDeclaredFields() throws Exception { List<Field> declaredFields = Reflection.getAllFields(ClassC.class, Object.class, new FieldAnnotationPredicate(InjectView.class)); assertEquals(2, declaredFields.size()); declaredFields = Reflection.getAllFields(ClassC.class, new FieldAnnotationPredicate(InjectAttribute.class)); assertEquals(1, declaredFields.size()); declaredFields = Reflection.getAllFields(ClassC.class, new FieldAnnotationPredicate(InjectResource.class)); assertEquals(1, declaredFields.size()); declaredFields = Reflection.getAllFields(ClassC.class, ClassB.class, new FieldAnnotationPredicate(InjectView.class)); assertEquals(1, declaredFields.size()); }
public static <T> List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding){ return getAllFields(clazz, Optional.<Class<? super T>>ofNullable(upToExcluding), Predicates.alwaysTrue()); }
Reflection { public static <T> List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding){ return getAllFields(clazz, Optional.<Class<? super T>>ofNullable(upToExcluding), Predicates.alwaysTrue()); } }
Reflection { public static <T> List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding){ return getAllFields(clazz, Optional.<Class<? super T>>ofNullable(upToExcluding), Predicates.alwaysTrue()); }  }
Reflection { public static <T> List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding){ return getAllFields(clazz, Optional.<Class<? super T>>ofNullable(upToExcluding), Predicates.alwaysTrue()); }  static List<Field> getAllFields(Class<T> clazz); static List<Field> getAllFields(Class<T> clazz, Predicate<Field> filter); static List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding); static List<Field> getAllFields(Class<T> clazz, Class<? super T> upToExcluding); static List<Field> getAllFields(Class<T> clazz, Class<? super T> upToExcluding, Predicate<? super Field> filter); static List<Field> getAllFields(Class<T> clazz, Optional<Class<? super T>> upToExcluding, Predicate<? super Field> filter); @Nullable static Class<?> getClassInClass(Class<?> rootClass, String innerClassName); static List<Class<?>> getActualTypeArguments(Class<?> clazz, Class<?> iface); }
Reflection { public static <T> List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding){ return getAllFields(clazz, Optional.<Class<? super T>>ofNullable(upToExcluding), Predicates.alwaysTrue()); }  static List<Field> getAllFields(Class<T> clazz); static List<Field> getAllFields(Class<T> clazz, Predicate<Field> filter); static List<Field> getDeclaredFields(Class<T> clazz, Class<? super T> upToExcluding); static List<Field> getAllFields(Class<T> clazz, Class<? super T> upToExcluding); static List<Field> getAllFields(Class<T> clazz, Class<? super T> upToExcluding, Predicate<? super Field> filter); static List<Field> getAllFields(Class<T> clazz, Optional<Class<? super T>> upToExcluding, Predicate<? super Field> filter); @Nullable static Class<?> getClassInClass(Class<?> rootClass, String innerClassName); static List<Class<?>> getActualTypeArguments(Class<?> clazz, Class<?> iface);  }