OTX-Runtime for DotNet
|
|
Converts OTX Value to Literal
in OTL notation and vice versa.
More...
Static Public Member Functions | |
static object | String2Value (string literal, string targetType) |
Converts a Literal into a value of the given data type. More... | |
static string | Value2String (object value) |
Converts a value from an element of the API to a Literal in OTL notation. More... | |
Converts OTX Value to Literal
in OTL notation and vice versa.
Static class for parameter value conversion of different data types available at the API
|
inlinestatic |
Converts a Literal
into a value of the given data type.
This method converts a Literal
in OTL notation into a value of the given data type. The Literal for the data type is formated in OTL notation and is therefore independent from the underlying software platform like C++, DotNet or Java. The string of the data type can be get via the DataType
method or property of the related OTX element, e.g. ProcedureParameter.
stringLiteral | String literal formatted in OTL notation, see OTX Data Types Supported at the API. |
targetDataType | OTL notation of the data type which the string literal will be converted to. To get the data type the property DataType of the related element can be used, e.g. ProcedureParameter. Examples: "String", "Integer", "Boolean", "List<String>", "Map<String, String>". If the data type is defined in the OTX, targetDataType must contain the full path name. Example: "StructurePackage1.Document1.StructureSignature1<String, Integer, Float>", "EnumerationElementPackage1.Document1.EnumerationSignature1", ... |
///
System.InvalidCastException | Thrown if literal string is null, or if targetType is null or empty. |
Exceptions.InvalidLiteralException | Thrown if the given string literal cannot be converted into the given data type. |
Example
|
inlinestatic |
Converts a value from an element of the API to a Literal
in OTL notation.
This method converts a value from an element of the API like a ProcedureParameter to a Literal
. The Literal
is formated in OTL notation and is therefore independent from the underlying software platform like C++, DotNet or Java, see OTX Data Types Supported at the API.
value | An arbitrary value of an OTX object e.g. ProcedureParameter. |
System.InvalidCastException | Throw if value is null. |
Exceptions.InvalidDataTypeException | Throw if the value's datatype is not supported in the api. |
Example