Default String Representation and asString
No edit summary |
(Automatically adding template at the end of the page.) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
You can use asString on all objects in OCL (the same | 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. | When you use asString, the DefaultStringRepresentation is used to get the result string. | ||
====== Note on | ====== Note on Performance ====== | ||
asString and the DefaultStringRepresentation | asString and the DefaultStringRepresentation are not [[Derived attributes & associations|subscribed]]. This means that every time the asString is used, it needs to be reevaluated. For better performance, create a [[Derived attributes & associations|derived attribute]] - for example, "Presentation" with the OCL - use <code>self.Presentation in DefaultStringRepresentation</code>. | ||
Also, avoid using asString in other expressions that need to have high performance | 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 | Keyword: Defaultstringrepresentation, asString | ||
[[Category:OCL]] | |||
{{Edited|July|12|2024}} |
Latest revision as of 15:33, 10 February 2024
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
This page was edited more than 11 months ago on 02/10/2024. What links here