I wonder is there a way to get all private fields of some class in java and their type.
For example lets suppose I have a class
class SomeClass {
Using Java 8 :
Field[] fields = String.class.getDeclaredFields(); List privateFieldList = Arrays.asList(fields).stream().filter(field -> Modifier.isPrivate(field.getModifiers())).collect( Collectors.toList());