Module net.automatalib.common.util
Interface SettingsSource
-
- All Known Subinterfaces:
AutomataLibSettingsSource
- All Known Implementing Classes:
AbstractClassPathFileSource
,AbstractSystemPropertiesSource
,AutomataLibLocalPropertiesSource
,AutomataLibPropertiesSource
,AutomataLibSystemPropertiesSource
,LocalFileSource
public interface SettingsSource
Utility 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 int
getPriority()
Returns the priority of this source.void
loadSettings(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 givenProperties
object.
-
-
-
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 instantiatedServiceLoader
instead of just the settings class, to support polymorphicSettingsSource
s in a JPMS environment. Otherwise,this
module would have to declare auses
clause and only trueSettingsSource
s could be read.- Type Parameters:
S
- concreteSettingsSource
type- Parameters:
loader
- the service loader- Returns:
- the filled properties after all loaded
SettingsSource
s have been queried
-
readSettings
static <S extends SettingsSource> void readSettings(ServiceLoader<S> loader, Properties p)
Convenience method forreadSettings(ServiceLoader)
that directly writes to the givenProperties
object.- Type Parameters:
S
- concreteSettingsSource
type- 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
-
-