Contains a key-value map with configuration parameters. All values stored as strings and can be serialized as JSON or string forms. When retrieved the values can be automatically converted on read using GetAsXXX methods.
More...
|
| ConfigParams () |
| Creates an instance of ConfigParams. More...
|
|
| ConfigParams (IDictionary< string, string > content) |
| Creates a new ConfigParams and fills it with values. More...
|
|
IEnumerable< string > | GetSectionNames () |
|
ConfigParams | GetSection (string section) |
| Gets parameters from specific section stored in this ConfigMap. The section name is removed from parameter keys. More...
|
|
void | AddSection (string section, ConfigParams sectionParams) |
| Adds parameters into this ConfigParams under specified section. Keys for the new parameters are appended with section dot prefix. More...
|
|
ConfigParams | Override (ConfigParams configParams) |
| Overrides parameters with new values from specified ConfigParams and returns a new ConfigParams object. More...
|
|
ConfigParams | SetDefaults (ConfigParams defaultConfigParams) |
| Set default values from specified ConfigParams and returns a new ConfigParams object. More...
|
|
| StringValueMap () |
| Creates a new instance of the map and assigns its value. More...
|
|
| StringValueMap (IDictionary< string, string > map) |
| Creates a new instance of the map and assigns its value. More...
|
|
| StringValueMap (object value) |
| Creates a new instance of the map and assigns its value. More...
|
|
virtual string | Get (string key) |
| Gets a map element specified by its key. More...
|
|
virtual void | Set (string key, string value) |
| Sets a new value for this array element by its key More...
|
|
void | Append (IDictionary< string, object > map) |
| Appends new elements to this map. More...
|
|
void | Append (IDictionary< string, string > map) |
| Appends new elements to this map. More...
|
|
object | GetAsObject () |
| Gets the value stored in this map element without any conversions More...
|
|
void | SetAsObject (object value) |
| Sets a new value for this array element More...
|
|
void | SetAsObject (string key, object value) |
| Sets a new value to map element specified by its index. When the index is not defined, it resets the entire map value.This method has double purpose because method overrides are not supported in JavaScript. More...
|
|
object | GetAsObject (string key) |
| Gets the value stored in map element without any conversions. When element key is not defined it returns the entire map value. More...
|
|
string | GetAsNullableString (string key) |
| Converts map element into a string or returns null if conversion is not possible. More...
|
|
string | GetAsString (string key) |
| Converts map element into a string or returns "" if conversion is not possible. More...
|
|
string | GetAsStringWithDefault (string key, string defaultValue) |
| Converts map element into a string or returns default value if conversion is not possible. More...
|
|
bool | GetAsNullableBoolean (string key) |
| Converts map element into a boolean or returns null if conversion is not possible. More...
|
|
bool | GetAsBoolean (string key) |
| Converts map element into a boolean or returns false if conversion is not possible. More...
|
|
bool | GetAsBooleanWithDefault (string key, bool defaultValue) |
| Converts map element into a boolean or returns default value if conversion is not possible. More...
|
|
int | GetAsNullableInteger (string key) |
| Converts map element into an integer or returns null if conversion is not possible. More...
|
|
int | GetAsInteger (string key) |
| Converts map element into an integer or returns 0 if conversion is not possible. More...
|
|
int | GetAsIntegerWithDefault (string key, int defaultValue) |
| Converts map element into an integer or returns default value if conversion is not possible. More...
|
|
long | GetAsNullableLong (string key) |
| Converts map element into a long or returns null if conversion is not possible. More...
|
|
long | GetAsLong (string key) |
| Converts map element into a long or returns 0 if conversion is not possible. More...
|
|
long | GetAsLongWithDefault (string key, long defaultValue) |
| Converts map element into a long or returns default value if conversion is not possible. More...
|
|
float | GetAsNullableFloat (string key) |
| Converts map element into a float or returns null if conversion is not possible. More...
|
|
float | GetAsFloat (string key) |
| Converts map element into a float or returns 0 if conversion is not possible. More...
|
|
float | GetAsFloatWithDefault (string key, float defaultValue) |
| Converts map element into a float or returns default value if conversion is not possible. More...
|
|
double | GetAsNullableDouble (string key) |
| Converts map element into a double or returns null if conversion is not possible. More...
|
|
double | GetAsDouble (string key) |
| Converts map element into a double or returns 0 if conversion is not possible. More...
|
|
double | GetAsDoubleWithDefault (string key, double defaultValue) |
| Converts map element into a double or returns default value if conversion is not possible. More...
|
|
DateTime | GetAsNullableDateTime (string key) |
| Converts map element into a Date or returns null if conversion is not possible. More...
|
|
DateTime | GetAsDateTime (string key) |
| Converts map element into a Date or returns current date if conversion is not possible. More...
|
|
DateTime | GetAsDateTimeWithDefault (string key, DateTime? defaultValue) |
| Converts map element into a Date or returns default value if conversion is not possible. More...
|
|
TimeSpan | GetAsNullableTimeSpan (string key) |
|
TimeSpan | GetAsTimeSpan (string key) |
|
TimeSpan | GetAsTimeSpanWithDefault (string key, TimeSpan? defaultValue) |
|
T | GetAsNullableEnum< T > (string key) |
|
T | GetAsEnum< T > (string key) |
|
T | GetAsEnumWithDefault< T > (string key, T defaultValue) |
|
T | GetAsNullableType< T > (string key) |
| Converts map element into a value defined by specied typecode. If conversion is not possible it returns null. More...
|
|
T | GetAsType< T > (string key) |
| Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specied typecode. More...
|
|
T | GetAsTypeWithDefault< T > (string key, T defaultValue) |
| Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value. More...
|
|
AnyValue | GetAsValue (string key) |
| Converts map element into an AnyValue or returns an empty AnyValue if conversion is not possible. More...
|
|
AnyValueArray | GetAsNullableArray (string key) |
| Converts map element into an AnyValueArray or returns null if conversion is not possible. More...
|
|
AnyValueArray | GetAsArray (string key) |
| Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible. More...
|
|
AnyValueArray | GetAsArrayWithDefault (string key, AnyValueArray defaultValue) |
| Converts map element into an AnyValueArray or returns default value if conversion is not possible. More...
|
|
AnyValueMap | GetAsNullableMap (string key) |
| Converts map element into an AnyValueMap or returns null if conversion is not possible. More...
|
|
AnyValueMap | GetAsMap (string key) |
| Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. More...
|
|
AnyValueMap | GetAsMapWithDefault (string key, AnyValueMap defaultValue) |
| Converts map element into an AnyValueMap or returns default value if conversion is not possible. More...
|
|
override string | ToString () |
| Gets a string representation of the object. The result is a semicolon-separated list of key-value pairs as "key1=value1;key2=value2;key=value3" More...
|
|
object | Clone () |
| Creates a binary clone of this object. More...
|
|
Contains a key-value map with configuration parameters. All values stored as strings and can be serialized as JSON or string forms. When retrieved the values can be automatically converted on read using GetAsXXX methods.
The keys are case-sensitive, so it is recommended to use consistent C-style as: "my_param"
Configuration parameters can be broken into sections and subsections using dot notation as: "section1.subsection1.param1"
. Using GetSection method all parameters from specified section can be extracted from a ConfigMap.
The ConfigParams supports serialization from/to plain strings as: "key1=123;key2=ABC;key3=2016-09-16T00:00:00.00Z"
ConfigParams are used to pass configurations to IConfigurable objects. They also serve as a basis for more concrete configurations such as ConnectionParams or CredentialParams.
var config =
ConfigParams.fromTuples(
"section1.key1",
"AAA",
"section1.key2", 123,
"section2.key1", true );
config.GetAsString("section1.key1");
config.GetAsInteger("section1.key1");
var section1 = config.GetSection("section1");
section1.ToString();
See IConfigurable, StringValueMap