class UserPreference {

    @NonNull
    public static synchronized List<UserPreference<?>> values() {
        if (CACHED_VALUES == null) {
            CACHED_VALUES = new ArrayList<>();
            final Class<?>[] declaredClasses = UserPreference.class.getDeclaredClasses();
            if (declaredClasses != null) {
                for (final Class<?> declaredClass : declaredClasses) {
                    final Field[] fields = declaredClass.getFields();
                    if (fields != null) {
                        for (final Field field : fields) {
                            if (UserPreference.class.equals(field.getType())) {
                                try {
                                    CACHED_VALUES.add((UserPreference<?>) field.get(declaredClass));
                                } catch (IllegalAccessException e) {
                                    Logger.warn(UserPreference.class, "Failed to get field " + field + " due to access exception", e);
                                }
                            }
                        }
                    }
                }
            }
        }
        return CACHED_VALUES;
    }

    private  UserPreference(@NonNull Class<T> type, @StringRes int name, @AnyRes int defaultValue);

}