public class MediaProviderConfig extends Object
Constructor and Description |
---|
MediaProviderConfig(MediaProviderInfo mpi) |
Modifier and Type | Method and Description |
---|---|
void |
addBoolean(String key,
boolean defaultValue)
adds a boolean parameter to the configuration
|
void |
addBoolean(String key,
String keyDescription,
boolean defaultValue)
adds a boolean parameter to the configuration
|
void |
addSelect(String key,
List<String> possibleValues,
String defaultValue)
adds a value selection to the configuration (List version)
|
void |
addSelect(String key,
String[] possibleValues,
String defaultValue)
adds a value selection to the configuration (Array version)
|
void |
addSelect(String key,
String keyDescription,
List<String> possibleValues,
String defaultValue)
adds a value selection to the configuration (List version)
|
void |
addSelect(String key,
String keyDescription,
String[] possibleValues,
String defaultValue)
adds a value selection to the configuration (Array version)
|
void |
addSelectIndex(String key,
List<String> possibleValues,
String defaultValue)
adds a value selection (via index) to the configuration (List version)
|
void |
addSelectIndex(String key,
String[] possibleValues,
String defaultValue)
adds a value selection (via index) to the configuration (Array version)
|
void |
addSelectIndex(String key,
String keyDescription,
List<String> possibleValues,
String defaultValue)
adds a value selection (via index) to the configuration (List version)
|
void |
addSelectIndex(String key,
String keyDescription,
String[] possibleValues,
String defaultValue)
adds a value selection (via index) to the configuration (Array version)
|
void |
addText(String key,
String defaultValue)
adds a text parameter to the configuration
|
void |
addText(String key,
String defaultValue,
boolean encrypt)
adds an encrypts text parameter to the configuration (useful for sensitive information)
|
void |
addText(String key,
String keyDescription,
String defaultValue)
adds a text parameter to the configuration
|
void |
addText(String key,
String keyDescription,
String defaultValue,
boolean encrypt)
adds an encrypts text parameter to the configuration (useful for sensitive information)
|
Map<String,String> |
getConfigKeyValuePairs()
convenient method, to return a key=value map of all config entries
|
MediaProviderConfigObject |
getConfigObject(String key)
returns a config object (or an empty one if not found)
|
Map<String,MediaProviderConfigObject> |
getConfigObjects() |
String |
getValue(String key)
gets the config value as string (or the default)
You might want to parse it to boolean if it is true|false You might get a number if it was setup to return the index might return an empty string! |
Boolean |
getValueAsBool(String key)
If you know that this key is a boolean, use that :)
will return NULL if it cannot be parsed as boolean |
Integer |
getValueIndex(String key)
gets the config value as index
works only on select boxes might return NULL if not found/parseable |
boolean |
hasConfig()
indicate whether a config is available or not
|
void |
load()
loads config from settings file
Should be called right after defining the configuration objects! |
void |
save() |
void |
setValue(String key,
boolean value)
set the given value to the config (boolean variant)
|
void |
setValue(String key,
String value)
set the given value to the config (String variant)
|
String |
toString() |
public MediaProviderConfig(MediaProviderInfo mpi)
public void load()
public void save()
public boolean hasConfig()
public Map<String,MediaProviderConfigObject> getConfigObjects()
public Map<String,String> getConfigKeyValuePairs()
public MediaProviderConfigObject getConfigObject(String key)
key
- the key to get the config objectpublic String getValue(String key)
key
- the key for the config value to getpublic Integer getValueIndex(String key)
key
- the key for the config value to getpublic Boolean getValueAsBool(String key)
key
- the key for the config value to getpublic void setValue(String key, String value)
key
- the to set the value forvalue
- the value to be setpublic void setValue(String key, boolean value)
key
- the to set the value forvalue
- the value to be setpublic void addBoolean(String key, boolean defaultValue)
key
- the config keydefaultValue
- the default valuepublic void addBoolean(String key, String keyDescription, boolean defaultValue)
key
- the config keykeyDescription
- the key descriptiondefaultValue
- the default valuepublic void addText(String key, String defaultValue)
key
- the config keydefaultValue
- the default valuepublic void addText(String key, String keyDescription, String defaultValue)
key
- the config keykeyDescription
- the key descriptiondefaultValue
- the default valuepublic void addText(String key, String defaultValue, boolean encrypt)
key
- the config keydefaultValue
- the default valueencrypt
- enable/disable encryptionpublic void addText(String key, String keyDescription, String defaultValue, boolean encrypt)
key
- the config keykeyDescription
- the key descriptiondefaultValue
- the default valueencrypt
- enable/disable encryptionpublic void addSelect(String key, String[] possibleValues, String defaultValue)
key
- the config keypossibleValues
- an array of possible valuesdefaultValue
- the default valuepublic void addSelect(String key, String keyDescription, String[] possibleValues, String defaultValue)
key
- the config keykeyDescription
- the key descriptionpossibleValues
- an array of possible valuesdefaultValue
- the default valuepublic void addSelect(String key, List<String> possibleValues, String defaultValue)
key
- the config keypossibleValues
- a list of possible valuesdefaultValue
- the default valuepublic void addSelect(String key, String keyDescription, List<String> possibleValues, String defaultValue)
key
- the config keykeyDescription
- the key descriptionpossibleValues
- a list of possible valuesdefaultValue
- the default valuepublic void addSelectIndex(String key, String[] possibleValues, String defaultValue)
key
- the config keypossibleValues
- an array of possible valuesdefaultValue
- the default valuepublic void addSelectIndex(String key, String keyDescription, String[] possibleValues, String defaultValue)
key
- the config keykeyDescription
- the key descriptionpossibleValues
- an array of possible valuesdefaultValue
- the default valuepublic void addSelectIndex(String key, List<String> possibleValues, String defaultValue)
key
- the config keypossibleValues
- a list of possible valuesdefaultValue
- the default valuepublic void addSelectIndex(String key, String keyDescription, List<String> possibleValues, String defaultValue)
key
- the config keykeyDescription
- the key descriptionpossibleValues
- a list of possible valuesdefaultValue
- the default valueCopyright © 2012–2019 tinyMediaManager. All rights reserved.