@Test public void testFindFields() { final Collection<Tuple<Class, Field>> result = Selector .from(SC.class) .findFields(); Assertions.assertEquals(SC.class.getDeclaredFields().length, result.size()); }
public Collection<Tuple<Class, Field>> findFields() { return classes .stream() .filter(classPredicates) .filter(filterClassesBasedOnMethods()) .flatMap(clazz -> Stream.of(clazz.getDeclaredFields())) .filter(fieldPredicates) .map(field -> Tuple.of(Class.class.cast(field.getDeclaringClass()), field)) .collect(Collectors.toList()); }
Selector { public Collection<Tuple<Class, Field>> findFields() { return classes .stream() .filter(classPredicates) .filter(filterClassesBasedOnMethods()) .flatMap(clazz -> Stream.of(clazz.getDeclaredFields())) .filter(fieldPredicates) .map(field -> Tuple.of(Class.class.cast(field.getDeclaringClass()), field)) .collect(Collectors.toList()); } }
Selector { public Collection<Tuple<Class, Field>> findFields() { return classes .stream() .filter(classPredicates) .filter(filterClassesBasedOnMethods()) .flatMap(clazz -> Stream.of(clazz.getDeclaredFields())) .filter(fieldPredicates) .map(field -> Tuple.of(Class.class.cast(field.getDeclaringClass()), field)) .collect(Collectors.toList()); } private  Selector(final Set<Class> classes); }
Selector { public Collection<Tuple<Class, Field>> findFields() { return classes .stream() .filter(classPredicates) .filter(filterClassesBasedOnMethods()) .flatMap(clazz -> Stream.of(clazz.getDeclaredFields())) .filter(fieldPredicates) .map(field -> Tuple.of(Class.class.cast(field.getDeclaringClass()), field)) .collect(Collectors.toList()); } private  Selector(final Set<Class> classes); static Selector from(final Collection<Class> classes); static Selector from(final Class clazz); static Selector from(final String packageName); Selector filterFields(final Predicate<Field> fieldPredicate); Selector filterMethods(final Predicate<Method> methodPredicate); Selector filterClasses(final Predicate<Class> classPredicate); Collection<Class> findClasses(); Collection<Tuple<Class, Method>> findMethods(); Collection<Tuple<Class, Field>> findFields(); }
Selector { public Collection<Tuple<Class, Field>> findFields() { return classes .stream() .filter(classPredicates) .filter(filterClassesBasedOnMethods()) .flatMap(clazz -> Stream.of(clazz.getDeclaredFields())) .filter(fieldPredicates) .map(field -> Tuple.of(Class.class.cast(field.getDeclaringClass()), field)) .collect(Collectors.toList()); } private  Selector(final Set<Class> classes); static Selector from(final Collection<Class> classes); static Selector from(final Class clazz); static Selector from(final String packageName); Selector filterFields(final Predicate<Field> fieldPredicate); Selector filterMethods(final Predicate<Method> methodPredicate); Selector filterClasses(final Predicate<Class> classPredicate); Collection<Class> findClasses(); Collection<Tuple<Class, Method>> findMethods(); Collection<Tuple<Class, Field>> findFields();  }