UML类图中的关联数组 [英] Associative array in UML class diagram

查看:95
本文介绍了UML类图中的关联数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要在类图中显示的数组.

I have an array that I want to show in a class diagram.

protected static $config = array(
        'host' => 'localhost',
        'username' => '',
        'password' => '',
        'dbname' => ''
    ); 

这是正确的方法吗?

并在整行上加上下划线表示为静态

and underlined the whole line for static

推荐答案

通常不会使用UML进行配置,但是您可以这样做.您需要创建实例规格以获得所需的结果.

Usually one doesn't use UML to configure things, but you can do it. You would need to create instance specifications to get the result you want.

您可以创建一个实例规范,类型为 AssociativeArray associativeArrayInstanceSpec1 ,该规范由许多其他的 AssociativeArrayEntry 实例规范组成,每个实例规范都有一个特定的键和价值.然后,您可以在 SomeClass 中将具有默认值的属性声明为 config:AssociativeArray [1] = associativeArrayInstanceSpec1 .

You could create an instance specification, associativeArrayInstanceSpec1 of type AssociativeArray that composes a bunch of other AssociativeArrayEntry instance specifications that each have a specific key and value. Then you could declare a property with a default value in SomeClass as config : AssociativeArray [1] = associativeArrayInstanceSpec1.

这篇关于UML类图中的关联数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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