use of org.neo4j.graphdb.config.SettingGroup in project neo4j by neo4j.
the class LoadableConfig method getConfigOptions.
/**
* Collects settings from implementors which may or may not have descriptions attached to them.
*
* @return a list of the implementing class's ConfigOptions
*/
default default List<ConfigOptions> getConfigOptions() {
ArrayList<ConfigOptions> configOptions = new ArrayList<>();
for (Field f : getClass().getDeclaredFields()) {
try {
Object publicSetting = f.get(this);
if (publicSetting instanceof BaseSetting) {
BaseSetting setting = (BaseSetting) publicSetting;
final Description documentation = f.getAnnotation(Description.class);
if (documentation != null) {
setting.setDescription(documentation.value());
}
final DocumentedDefaultValue defValue = f.getAnnotation(DocumentedDefaultValue.class);
if (defValue != null) {
setting.setDocumentedDefaultValue(defValue.value());
}
final Deprecated deprecatedAnnotation = f.getAnnotation(Deprecated.class);
setting.setDeprecated(deprecatedAnnotation != null);
final ReplacedBy replacedByAnnotation = f.getAnnotation(ReplacedBy.class);
if (replacedByAnnotation != null) {
setting.setReplacement(replacedByAnnotation.value());
}
final Internal internalAnnotation = f.getAnnotation(Internal.class);
setting.setInternal(internalAnnotation != null);
}
if (publicSetting instanceof SettingGroup) {
SettingGroup setting = (SettingGroup) publicSetting;
configOptions.add(new ConfigOptions(setting));
}
} catch (IllegalAccessException ignored) {
// Field is private, ignore it
continue;
}
}
return configOptions;
}
Aggregations