Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Uffe on May 06, 2009, 09:48:36 pm
-
Hey everybody,
I'm almost embarrassed to ask, but admitting that you have a problem is the first step and all that.
Specifying that an operation parameter is an array: how?
Operation return values may be specified as as arrays by ticking the box in the operation details dialog. But there's no similar one in the parameter detail dialog.
If I manually add [] to the end of the parameter type name, EA doesn't warn me that the parameter fails to parse, which it does if I add, say, just the [.
So is this the correct way of doing it, or is there another correcter way?
Cheers,
/Uffe
-
Hi Uffe,
That's a really good question. AFAIK there is no way to do this 'directly' within the containing class. It seems you can directly specify a collection for an attribute, but not for an operation parameter.
If EA allows both brackets but complains when you add one bracket (or otherwise provide illegal syntax), then I think you are OK. At least this will work for arrays of simple types. Have you tried this with a source code language that uses different syntax? Perhaps VB.Net instead of C(something) so that you'd need parentheses instead of square brackets. If you do this and get a complaint about the wrong syntax (when you use the wrong bracket type) you may have your answer.
For collections things could get more difficult. My best guess--this certainly works, but I am not certain whether it was the (only) way that Sparx intended--is to create a class (or other datatype artifact) to represent your collection. Then reference that entity using the '...' button on the dialog. This is a bit more convoluted than with parameters, but in a well defined model should not add significant (or perhaps any) complexity to the overall model.
Can anyone else shed some light on this?
David