C#:帮助了解<<< property>>>在UML类图中 [英] C#: Help understanding <<property>> in UML Class Diagrams
问题描述
我目前正在做一个项目,我们必须从UML图制作代码.我了解UML类图的剖析,但是我难以理解<< property>>
的含义以及如何将其实现到我的代码中.
I am currently doing a project where we have to make code from UML diagrams. I understand the anatomy of a UML class diagram but I'm having trouble understanding what <<property>>
means and how to implement it into my code.
推荐答案
<<属性>>
是一种刻板印象(就像UML中大多数东西都被<<>>
).在这种情况下,它指示您应为相应命名的类的私有属性实现getter和setter.例如.对于 Status
,您将实现 getStatus
和 setStatus
(或用于此目的的目标语言).由于还存在 Name
的约束 {只读}
,因此您只需实现 getName
.您可能不得不猜测该属性的名称是 _bookName
.
<<property>>
is a stereotype (like most things in UML embraced by << >>
). In this case it indicates that you shall implement getters and setters for the accordingly named privately owned attributes of the class. E.g. for the Status
you would implement getStatus
and setStatus
(or whatever is used in the target language for that purpose). As there's also the constraint { readonly }
for Name
you shall just implement getName
. You probably have to guess that the attribute's name is _bookName
.
这篇关于C#:帮助了解<<< property>>>在UML类图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!