Module net.automatalib.common.util
Interface SettingsSource
- All Known Subinterfaces:
AutomataLibSettingsSource
- All Known Implementing Classes:
AbstractClassPathFileSource,AbstractSystemPropertiesSource,AutomataLibLocalPropertiesSource,AutomataLibPropertiesSource,AutomataLibSystemPropertiesSource,LocalFileSource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Utility interface to mark the source of a setting.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the priority of this source.voidloadSettings(Properties props) Load the parsed settings into the given property object.static <S extends SettingsSource>
PropertiesreadSettings(ServiceLoader<S> loader) Convenience method for parsing properties from aSettingsSource.static <S extends SettingsSource>
voidreadSettings(ServiceLoader<S> loader, Properties p) Convenience method forreadSettings(ServiceLoader)that directly writes to the givenPropertiesobject.
-
Method Details
-
readSettings
Convenience method for parsing properties from aSettingsSource. Note that this method requires an instantiatedServiceLoaderinstead of just the settings class, to support polymorphicSettingsSources in a JPMS environment. Otherwise,thismodule would have to declare ausesclause and only trueSettingsSources could be read.- Type Parameters:
S- concreteSettingsSourcetype- Parameters:
loader- the service loader- Returns:
- the filled properties after all loaded
SettingsSources have been queried
-
readSettings
Convenience method forreadSettings(ServiceLoader)that directly writes to the givenPropertiesobject.- Type Parameters:
S- concreteSettingsSourcetype- Parameters:
loader- the service loaderp- the properties object to write to
-
loadSettings
Load the parsed settings into the given property object.- Parameters:
props- the object to write the settings to
-
getPriority
default int getPriority()Returns the priority of this source. This is used to decide which source wins, if multiple sources write the same properties.- Returns:
- the priority
-