public class SettingsImpl extends Object implements Settings
| Constructor and Description |
|---|
SettingsImpl(PropertiesHandler handler) |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addChoiceSetting(String key,
ChoiceSetting<T> setting)
Adds an
ChoiceSetting to the settings container. |
void |
addFileSetting(String key,
FileSetting setting)
Adds an
FileSetting to the settings container. |
<T> void |
addMultiselectSetting(String key,
MultiselectSetting<T> setting)
Adds an
MultiselectSetting to the settings container. |
<T extends Number> |
addRangeSetting(String key,
RangeSetting<T> setting)
Adds an
RangeSetting to the settings container. |
<T> void |
addUnboundedSetting(String key,
UnboundedSetting<T> setting)
Adds an
UnboundedSetting to the settings container. |
<T> ChoiceSetting<T> |
getChoiceSetting(String key)
Returns the
ChoiceSetting with the specified key. |
FileSetting |
getFileSetting(String key)
Returns the
FileSetting with the specified key. |
<T> MultiselectSetting<T> |
getMultiselectSetting(String key)
Returns the
MultiselectSetting with the specified key. |
<T extends Number> |
getRangeSetting(String key)
Returns the
RangeSetting with the specified key. |
<T> Setting<T> |
getSetting(String key)
Returns the value associated with the specified key.
|
Map<String,SettingType> |
getSettingTypes()
This function allows you to get all setting types by key.
|
<T> UnboundedSetting<T> |
getUnboundedSetting(String key)
Returns the
UnboundedSetting with the specified key. |
boolean |
isEmpty() |
void |
load()
Loads all settings from the persistence layer and updates the provided default values.
|
void |
save()
Saves all settings stored in this container to the persistence layer.
|
public SettingsImpl(PropertiesHandler handler)
public <T> Setting<T> getSetting(String key)
SettingsgetSetting in interface SettingsT - the type of value you want tokey - the name of the setting you want to querypublic <T> UnboundedSetting<T> getUnboundedSetting(String key)
SettingsUnboundedSetting with the specified key.getUnboundedSetting in interface SettingsT - The value type you want to fetchkey - the name of the setting you want to querypublic <T> void addUnboundedSetting(String key, UnboundedSetting<T> setting)
SettingsUnboundedSetting to the settings container.addUnboundedSetting in interface SettingsT - the type of value the setting should containkey - the key to store the value tosetting - the UnboundedSetting you want to storepublic <T> ChoiceSetting<T> getChoiceSetting(String key)
SettingsChoiceSetting with the specified key.getChoiceSetting in interface SettingsT - The value type you want to fetchkey - the name of the setting you want to querypublic <T> void addChoiceSetting(String key, ChoiceSetting<T> setting)
SettingsChoiceSetting to the settings container.addChoiceSetting in interface SettingsT - the type of value the setting should containkey - the key to store the value tosetting - the ChoiceSetting you want to storepublic <T extends Number> RangeSetting<T> getRangeSetting(String key)
SettingsRangeSetting with the specified key.getRangeSetting in interface SettingsT - The value type you want to fetchkey - the name of the setting you want to querypublic <T extends Number> void addRangeSetting(String key, RangeSetting<T> setting)
SettingsRangeSetting to the settings container.addRangeSetting in interface SettingsT - the type of value the setting should containkey - the key to store the value tosetting - the RangeSetting you want to storepublic FileSetting getFileSetting(String key)
SettingsFileSetting with the specified key.getFileSetting in interface Settingskey - the name of the setting you want to queryFileSetting with the specified keypublic void addFileSetting(String key, FileSetting setting)
SettingsFileSetting to the settings container.addFileSetting in interface Settingskey - the key to store the value tosetting - the FileSetting you want to storepublic <T> MultiselectSetting<T> getMultiselectSetting(String key)
SettingsMultiselectSetting with the specified key.getMultiselectSetting in interface SettingsT - The value type you want to fetchkey - the name of the setting you want to querypublic <T> void addMultiselectSetting(String key, MultiselectSetting<T> setting)
SettingsMultiselectSetting to the settings container.addMultiselectSetting in interface SettingsT - the type of value the setting should containkey - the key to store the value tosetting - the MultiselectSetting you want to storepublic Map<String,SettingType> getSettingTypes()
SettingsgetSettingTypes in interface Settingspublic void save()
Settingspublic void load()
Settingspublic boolean isEmpty()
Copyright © 2017. All rights reserved.