Pip-Services-Commons-Dotnet
|
Cross-language implementation of dynamic object map (dictionary) what can hold values of any type. The stored values can be converted to different types using variety of accessor methods. More...
Public Member Functions | |
AnyValueMap () | |
Creates a new instance of the map and assigns its value. More... | |
AnyValueMap (IDictionary< string, object > values) | |
Creates a new instance of the map and assigns its value. More... | |
AnyValueMap (IDictionary values) | |
Creates a new instance of the map and assigns its value. More... | |
virtual object | Get (string key) |
Gets a map element specified by its key. More... | |
virtual void | Set (string key, object value) |
Sets a new value for this map element More... | |
void | Append (IDictionary< string, object > map) |
Appends new elements to this map. More... | |
void | Append (IDictionary map) |
Appends new elements to this map. More... | |
object | GetAsObject () |
Gets the value stored in this map element without any conversions 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... | |
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... | |
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 | 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 | GetAsNullableType< T > (string key) |
Converts map element into a value defined by specied typecode. If conversion is not possible it returns null. 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... | |
object | Clone () |
Creates a binary clone of this object. More... | |
Static Public Member Functions | |
static AnyValueMap | FromValue (object value) |
Converts specified value into AnyValueMap. More... | |
static AnyValueMap | FromTuples (params object[] tuples) |
Creates a new AnyValueMap from a list of key-value pairs called tuples. More... | |
static AnyValueMap | FromMaps (params IDictionary[] maps) |
Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps. More... | |
Properties | |
new object | this[string key] [get, set] |
Cross-language implementation of dynamic object map (dictionary) what can hold values of any type. The stored values can be converted to different types using variety of accessor methods.
See StringConverter, BooleanConverter, IntegerConverter, LongConverter, DoubleConverter, FloatConverter, DateTimeConverter, ICloneable
PipServices3.Commons.Data.AnyValueMap.AnyValueMap | ( | ) |
Creates a new instance of the map and assigns its value.
PipServices3.Commons.Data.AnyValueMap.AnyValueMap | ( | IDictionary< string, object > | values | ) |
Creates a new instance of the map and assigns its value.
values | (optional) values to initialize this map. |
PipServices3.Commons.Data.AnyValueMap.AnyValueMap | ( | IDictionary | values | ) |
Creates a new instance of the map and assigns its value.
values | (optional) values to initialize this map. |
void PipServices3.Commons.Data.AnyValueMap.Append | ( | IDictionary< string, object > | map | ) |
Appends new elements to this map.
map | a map with elements to be added. |
void PipServices3.Commons.Data.AnyValueMap.Append | ( | IDictionary | map | ) |
Appends new elements to this map.
map | a map with elements to be added. |
object PipServices3.Commons.Data.AnyValueMap.Clone | ( | ) |
Creates a binary clone of this object.
Implements PipServices3.Commons.Data.ICloneable.
|
static |
Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps.
maps | an array of maps to be merged |
|
static |
Creates a new AnyValueMap from a list of key-value pairs called tuples.
tuples | a list of values where odd elements are keys and the following even elements are values |
|
static |
Converts specified value into AnyValueMap.
value | value to be converted |
|
virtual |
Gets a map element specified by its key.
key | a key of the element to get. |
Reimplemented in PipServices3.Commons.Run.Parameters.
AnyValueArray PipServices3.Commons.Data.AnyValueMap.GetAsArray | ( | string | key | ) |
Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
key | a key of element to get. |
AnyValueArray PipServices3.Commons.Data.AnyValueMap.GetAsArrayWithDefault | ( | string | key, |
AnyValueArray | defaultValue | ||
) |
Converts map element into an AnyValueArray or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
bool PipServices3.Commons.Data.AnyValueMap.GetAsBoolean | ( | string | key | ) |
Converts map element into a boolean or returns false if conversion is not possible.
key | a key of element to get. |
bool PipServices3.Commons.Data.AnyValueMap.GetAsBooleanWithDefault | ( | string | key, |
bool | defaultValue | ||
) |
Converts map element into a boolean or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See BooleanConverter.ToBooleanWithDefault(object, bool)
DateTime PipServices3.Commons.Data.AnyValueMap.GetAsDateTime | ( | string | key | ) |
Converts map element into a Date or returns current date if conversion is not possible.
key | a key of element to get. |
DateTime PipServices3.Commons.Data.AnyValueMap.GetAsDateTimeWithDefault | ( | string | key, |
DateTime? | defaultValue | ||
) |
Converts map element into a Date or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See DateTimeConverter.ToDateTimeWithDefault(object, DateTime?)
double PipServices3.Commons.Data.AnyValueMap.GetAsDouble | ( | string | key | ) |
Converts map element into a double or returns 0 if conversion is not possible.
key | a key of element to get. |
double PipServices3.Commons.Data.AnyValueMap.GetAsDoubleWithDefault | ( | string | key, |
double | defaultValue | ||
) |
Converts map element into a double or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See DoubleConverter.ToDoubleWithDefault(object, double)
float PipServices3.Commons.Data.AnyValueMap.GetAsFloat | ( | string | key | ) |
Converts map element into a float or returns 0 if conversion is not possible.
key | a key of element to get. |
float PipServices3.Commons.Data.AnyValueMap.GetAsFloatWithDefault | ( | string | key, |
float | defaultValue | ||
) |
Converts map element into a float or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See FloatConverter.ToFloatWithDefault(object, float)
int PipServices3.Commons.Data.AnyValueMap.GetAsInteger | ( | string | key | ) |
Converts map element into an integer or returns 0 if conversion is not possible.
key | a key of element to get. |
int PipServices3.Commons.Data.AnyValueMap.GetAsIntegerWithDefault | ( | string | key, |
int | defaultValue | ||
) |
Converts map element into an integer or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See IntegerConverter.ToIntegerWithDefault(object, int)
long PipServices3.Commons.Data.AnyValueMap.GetAsLong | ( | string | key | ) |
Converts map element into a long or returns 0 if conversion is not possible.
key | a key of element to get. |
long PipServices3.Commons.Data.AnyValueMap.GetAsLongWithDefault | ( | string | key, |
long | defaultValue | ||
) |
Converts map element into a long or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See LongConverter.ToLongWithDefault(object, long)
AnyValueMap PipServices3.Commons.Data.AnyValueMap.GetAsMap | ( | string | key | ) |
Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.
key | a key of element to get. |
AnyValueMap PipServices3.Commons.Data.AnyValueMap.GetAsMapWithDefault | ( | string | key, |
AnyValueMap | defaultValue | ||
) |
Converts map element into an AnyValueMap or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
AnyValueArray PipServices3.Commons.Data.AnyValueMap.GetAsNullableArray | ( | string | key | ) |
Converts map element into an AnyValueArray or returns null if conversion is not possible.
key | a key of element to get. |
See AnyValueArray
bool PipServices3.Commons.Data.AnyValueMap.GetAsNullableBoolean | ( | string | key | ) |
Converts map element into a boolean or returns null if conversion is not possible.
key | a key of element to get. |
See BooleanConverter.ToNullableBoolean(object)
DateTime PipServices3.Commons.Data.AnyValueMap.GetAsNullableDateTime | ( | string | key | ) |
Converts map element into a Date or returns null if conversion is not possible.
key | a key of element to get. |
See DateTimeConverter.ToNullableDateTime(object)
double PipServices3.Commons.Data.AnyValueMap.GetAsNullableDouble | ( | string | key | ) |
Converts map element into a double or returns null if conversion is not possible.
key | a key of element to get. |
See DoubleConverter.ToNullableDouble(object)
float PipServices3.Commons.Data.AnyValueMap.GetAsNullableFloat | ( | string | key | ) |
Converts map element into a float or returns null if conversion is not possible.
key | a key of element to get. |
See FloatConverter.ToNullableFloat(object)
int PipServices3.Commons.Data.AnyValueMap.GetAsNullableInteger | ( | string | key | ) |
Converts map element into an integer or returns null if conversion is not possible.
key | a key of element to get. |
See IntegerConverter.ToNullableInteger(object)
long PipServices3.Commons.Data.AnyValueMap.GetAsNullableLong | ( | string | key | ) |
Converts map element into a long or returns null if conversion is not possible.
key | a key of element to get. |
See LongConverter.ToNullableLong(object)
AnyValueMap PipServices3.Commons.Data.AnyValueMap.GetAsNullableMap | ( | string | key | ) |
Converts map element into an AnyValueMap or returns null if conversion is not possible.
key | a key of element to get. |
string PipServices3.Commons.Data.AnyValueMap.GetAsNullableString | ( | string | key | ) |
Converts map element into a string or returns null if conversion is not possible.
key | a key of element to get. |
See StringConverter.ToNullableString(object)
T PipServices3.Commons.Data.AnyValueMap.GetAsNullableType< T > | ( | string | key | ) |
Converts map element into a value defined by specied typecode. If conversion is not possible it returns null.
T | the class type |
key | a key of element to get. |
See TypeConverter.ToNullableType<T>(object)
T | : | struct |
object PipServices3.Commons.Data.AnyValueMap.GetAsObject | ( | ) |
Gets the value stored in this map element without any conversions
object PipServices3.Commons.Data.AnyValueMap.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.
key | (optional) a key of the element to get |
string PipServices3.Commons.Data.AnyValueMap.GetAsString | ( | string | key | ) |
Converts map element into a string or returns "" if conversion is not possible.
key | a key of element to get. |
string PipServices3.Commons.Data.AnyValueMap.GetAsStringWithDefault | ( | string | key, |
string | defaultValue | ||
) |
Converts map element into a string or returns default value if conversion is not possible.
key | a key of element to get. |
defaultValue | the default value |
See StringConverter.ToStringWithDefault(object, string)
T PipServices3.Commons.Data.AnyValueMap.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.
T | the class type |
key | a key of element to get. |
See TypeConverter.ToType<T>(object)
T PipServices3.Commons.Data.AnyValueMap.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.
T | the class type |
key | a key of element to get. |
defaultValue | the default value |
See TypeConverter.ToTypeWithDefault<T>(object, T)
AnyValue PipServices3.Commons.Data.AnyValueMap.GetAsValue | ( | string | key | ) |
|
virtual |
Sets a new value for this map element
key | (optional) a key of the element to set |
value | a new element or map value. |
Reimplemented in PipServices3.Commons.Run.Parameters.
void PipServices3.Commons.Data.AnyValueMap.SetAsObject | ( | object | value | ) |
Sets a new value for this array element
value | the new object value. |
void PipServices3.Commons.Data.AnyValueMap.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.
key | (optional) a key of the element to set |
value | a new element or map value. |