如何specifiy列举文字作为UML属性的默认值? [英] How to specifiy enumeration literal as default value in UML Attribute?

查看:350
本文介绍了如何specifiy列举文字作为UML属性的默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在做使用EMF,UML-实施一些模型转换。
在我的模式转型,我创建了一些属性的UML类。这些属性是枚举我还创建的类型。
一些属性应该得到一个默认值。默认值应该是枚举文字。

I currently doing some model transformations using EMF-UML-Implementation. In my model transformation I create an uml class with some attributes. The attributes are type of enumerations I also created. Some of the attribute should get a default value. The default value should be enumeration literals.

现在的问题是,我怎么让枚举文字到属性设置defaultValue - 属性。

The question now is, how do I get the enumeration literals to the defaultValue-property of the Property.

我已经发现,我必须使用 ValueSpecification 。但UML上层建筑说没有太多关于(第139页F。)。我有哪些属性用于将默认值设置为列举文字?

I already have found that I have to use ValueSpecification. But the UML superstructure says not much about that (page 139 f.). Which properties do I have to use for setting the defaultValue to enumeration literals?

我觉得我有主要的问题是,即使用 ValueSpecification 的我不清楚。目前,我只用默认来设置默认值,这是字符串类型。

I think the main problem I have is, that the use of ValueSpecification is unclear to me. Currently I only use default to set the default values, which is type of String.

推荐答案

设置defaultValue - 属性需要 ValueSpecification 论据。所以你的情况,你需要一个 InstanceValue 用于此目的(从 ValueSpecification 派生)。在 InstanceValue 本身有一个实例 - 属性,这需要一个 InstanceSpecification 作为参数。由于 EnumerationLiteral InstanceSpecification 导出,你现在可以简单地分配你的 EnumerationLiterals 吧。

The defaultValue-property takes a ValueSpecification argument. So in your case, you need an InstanceValue for this purpose (which derives from ValueSpecification). The InstanceValue itself has an instance-property, which takes an InstanceSpecification as argument. As EnumerationLiteral derives from InstanceSpecification, you can now simply assign one of your EnumerationLiterals to it.

这篇关于如何specifiy列举文字作为UML属性的默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆