List<MutableAccessor> (@NotNull Class<?> type, @NotNull Configuration configuration) { List<MutableAccessor> result = null; for (Field field : type.getDeclaredFields()) { int modifiers = field.getModifiers(); if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers)) { continue; } if (!configuration.hasStoreAnnotations(field)) { if (!configuration.collectPrivateFields && !(Modifier.isPublic(modifiers))) { continue; } if (!configuration.collectFinalFields && Modifier.isFinal(modifiers)) { Class<?> fieldType = field.getType(); // we don't want to allow final fields of all types, but only supported if (!(Collection.class.isAssignableFrom(fieldType) || Map.class.isAssignableFrom(fieldType))) { continue; } } if (configuration.isAnnotatedAsTransient(field)) { continue; } } if (result == null) { result = new ArrayList<>(); } result.add(new FieldAccessor(field)); } return result == null ? Collections.emptyList() : result; }