Documentation Language: Swift

Method

convertToString(_:_:)

Converts a value to a string literal for the given data type.

func convertToString(_ eDataType: EDataType, _ value: any EcoreValue) -> String

Parameters

eDataType

The data type of the value.

value

The value to convert.

Return Value

The string representation of the value.

Discussion

Converts a typed value to its string representation. This is used during serialisation (e.g., to XMI or JSON) to convert attribute values to strings.

Example

let intType = EDataType(name: "EInt")
let literal = factory.convertToString(intType, 42)
print(literal)  // "42"