如何在运行时将属性值设置为类的实例

时间:2018-06-04 14:13:07

标签: enterprise-architect

我在Enterprise Architect 14上。我有一个包含接口User和两个类EmployeeCustomer的组件图,其中realize接口{{1 }}

enter image description here

此外,我创建了两个实例,每个类之一,并通过User>指定属性的值。 Features & Properties

enter image description here

接下来,我创建了一个包含2个属性的组件,一个类型为Set Run State...,另一个类型为Employee。然后我创建了一个组件的实例。

enter image description here

现在,我想通过将Customer分配给ArbitraryUser属性并将Employee分配给组件实例的ArbitraryCustomer属性来设置组件实例的运行状态。根据文件,这应该是可能的(见here)。

  

在运行时,Object实例可以具有其属性的特定值,或者以特定状态存在。要在运行时模拟对象的变化行为,请使用从“选择”对话框和运行时状态或运行状态中选择的实例值。

但是我无法弄清楚如何做到这一点。有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

AFAIK that is not possible.
I'm not sure what the quote from the help really means, but I've only ever been able to type a value for the run state.

An partial alternative would be to use associations rather than attributes to model such relations. Then you can create a link as an instance of the association to relate instances of Employee or Customer with instances of a ArbitraryComponent.

This solution doesn't work for datatypes, but it seems a bit far fetched to start modelling instances of datatypes.