/** * Gets all global configuration properties filtered by the specified scope. * * @param scope the scope to filter by * @return the properties */ public static List<ConfigProperty> getConfiguration(Scope scope) { ConfigurationValueOptions useRawDisplayValue = ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(true); return Configuration.keySet().stream() .filter(key -> key.getScope().contains(scope)) .filter(key -> key.isValid(key.getName())) .map(key -> new ConfigProperty() .setName(key.getName()) .setSource(Configuration.getSource(key).toString()).setValue( Configuration.isSet(key) ? Configuration.get(key, useRawDisplayValue) : null)) .collect(toList()); }
@Override public List<ConfigProperty> getConfiguration(GetConfigurationOptions options) { List<ConfigProperty> configInfoList = new ArrayList<>(); for (PropertyKey key : Configuration.keySet()) { if (key.isBuiltIn()) { String source = Configuration.getSource(key).toString(); String value = Configuration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true) .useRawValue(options.isRawValue())); configInfoList .add(new ConfigProperty().setName(key.getName()).setValue(value).setSource(source)); } } return configInfoList; }