如何specifiy列举文字作为UML属性的默认值? [英] How to specifiy enumeration literal as default value in UML Attribute?
问题描述
我目前正在做使用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 $之一C $ C>吧。
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屋!