Default String Representation and asString
(Adding message template to the top of the page)
(Replacing message template with parser tag)
Line 1: Line 1:
{{message|Write the content here to display this box}}
<message>Write the content here to display this box</message>
You can use asString on all objects in OCL (the same way as you can in C#, for example).
You can use asString on all objects in OCL (the same way as you can in C#, for example).



Revision as of 07:41, 17 June 2024

This page was created by Lars.olofsson@mdriven.net on 2022-07-16. Last edited by Stephanie@mdriven.net on 2025-01-22.

You can use asString on all objects in OCL (the same way as you can in C#, for example).

When you use asString, the DefaultStringRepresentation is used to get the result string.

Note on Performance

asString and the DefaultStringRepresentation are not subscribed. This means that every time the asString is used, it needs to be reevaluated. For better performance, create a derived attribute - for example, "Presentation" with the OCL - use self.Presentation in DefaultStringRepresentation.

Also, avoid using asString in other expressions that need to have high performance because they cannot subscribe properly if you use asString in the expression tree.

Keyword: Defaultstringrepresentation, asString

MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments