List<Field> (Class<?> codeStyleClass) { List<Field> fields = new ArrayList<>(); Field[] allFields = useDeclaredFields() ? codeStyleClass.getDeclaredFields() : codeStyleClass.getFields(); for (Field field : allFields) { if (isPublic(field) && !isFinal(field)) { fields.add(field); } } return fields; }