Package com.sodius.oslc.server
Class Settings
java.lang.Object
com.sodius.oslc.server.Settings
Manages the edition of setting store.
Settings can be valid for an entire server (no scope), or can be scoped to a smaller entity, such as a project or a user.
- Since:
- 2.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes a setting.booleangetBoolean(String key) Returns existing setting for the given key.booleangetBoolean(String key, boolean defaultValue) Returns existing setting for the given key.Returns existing setting for the given key.Returns existing setting for the given key.getStrings(String key, char separator) Returns settings for the given key.static SettingsReturns the settings for the given scope.static SettingsscopeOrServer(String scope) Returns the settings for the given scope.static Settingsserver()Returns the settings scoped to the server.voidsetBoolean(String key, boolean value) Stores a setting.voidStores a setting.voidsetStrings(String key, List<String> values, char separator) Stores a list of values.
-
Method Details
-
server
Returns the settings scoped to the server.- Returns:
- the settings
-
scope
Returns the settings for the given scope.- Parameters:
scope- the scope identifier- Returns:
- the settings
- Since:
- 3.5.0
-
scopeOrServer
Returns the settings for the given scope. In case the setting hasn't been defined in the scope, the server setting is returned.- Parameters:
scope- the scope identifier- Returns:
- the settings
- Since:
- 3.5.0
-
getString
Returns existing setting for the given key.- Parameters:
key- the setting key- Returns:
- the stored setting
- Throws:
SettingStoreException- if an error occurs while querying the setting
-
getString
Returns existing setting for the given key. If the setting key doesn't exist or no value is assigned to it, returns the default value.- Parameters:
key- the setting keydefaultValue- the default setting value- Returns:
- the stored setting
- Throws:
SettingStoreException- if an error occurs while querying the setting
-
setString
Stores a setting. If the setting key already exists, the value is updated.- Parameters:
key- the setting keyvalue- the setting value- Throws:
SettingStoreException- if an error occurs while querying the setting
-
getBoolean
Returns existing setting for the given key.- Parameters:
key- the setting key- Returns:
- the stored setting
- Throws:
SettingStoreException- if an error occurs while querying the setting
-
getBoolean
Returns existing setting for the given key. If the setting key doesn't exist, returns the default value.- Parameters:
key- the setting keydefaultValue- the default setting value- Returns:
- the stored setting
- Throws:
SettingStoreException- if an error occurs while querying the setting
-
setBoolean
Stores a setting. If the setting key already exists, the value is updated.- Parameters:
key- the setting keyvalue- the setting value- Throws:
SettingStoreException- if an error occurs while querying the setting
-
getStrings
Returns settings for the given key. If the setting key doesn't exist or no value is assigned to it, returns an empty list. Otherwise the stored setting is split using the given separator to return a list of values.- Parameters:
key- the setting keyseparator- the separator that was used for storing the list of values- Returns:
- the stored settings
- Throws:
SettingStoreException- if an error occurs while querying the setting- See Also:
-
setStrings
public void setStrings(String key, List<String> values, char separator) throws SettingStoreException Stores a list of values. The separator character is used for combining the list of values in a single String to store. If the setting key already exists, the value is updated.- Parameters:
key- the setting keyvalues- a list of valuesseparator- the separator character to use for combining the list of values in a single String to store.- Throws:
SettingStoreException- if an error occurs while querying the setting- See Also:
-
delete
Deletes a setting. If the setting does not exist, nothing is done and no error is thrown.- Parameters:
key- the setting key- Throws:
SettingStoreException- if an error occurs while querying the setting
-