Module net.automatalib.common.util
Interface SettingsSource
-
- All Known Subinterfaces:
AutomataLibSettingsSource
- All Known Implementing Classes:
AbstractClassPathFileSource,AbstractSystemPropertiesSource,AutomataLibLocalPropertiesSource,AutomataLibPropertiesSource,AutomataLibSystemPropertiesSource,LocalFileSource
public interface SettingsSourceUtility interface to mark the source of a setting.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default intgetPriority()Returns 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 Detail
-
readSettings
static <S extends SettingsSource> Properties readSettings(ServiceLoader<S> loader)
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
static <S extends SettingsSource> void readSettings(ServiceLoader<S> loader, Properties p)
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
void loadSettings(Properties props)
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
-
-