首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

UML2.0中的Property跟Attribute

2012-10-20 
UML2.0中的Property和Attribute仅仅描述原文,进行一定的翻译,细节再慢慢体会:??1. 元模型中Property的定义

UML2.0中的Property和Attribute

仅仅描述原文,进行一定的翻译,细节再慢慢体会:

?

?

1. 元模型中Property的定义[1]:

?

A property is a typed element that represents an attribute of a class.

?

一个特性(property)是一个有类型的元素(typed element),它代表了一个类中的一个属性(Attribute


2. 元模型中:Core::Constructs::Class Diagram[2]

A property is a structural feature of a classifier that characterizes instances of the classifier. Constructs::Property merges the definition of Basic::Property with Constructs::StructuralFeature.

When a property is owned by a class it represents an attribute. In this case it relates an instance of the class to a value or set of values of the type of the attribute.

When a property is owned by an association it represents a non-navigable end of the association. In this case the type of the property is the type of the end of the association.

Property represents a declared state of one or more instances in terms of a named relationship to a value or values. When a property is an attribute of a classifier, the value or values are related to the instance of the classifier by being held in slots of the instance. When a property is an association end, the value or values are related to the instance or instances at the other end(s) of the association (see semantics of Association).

?

Property用来刻画这个类元(classifier)实例的结构化特征。Constructs包中的Property(Constructs::Property)结合了Basic::Property和Constructs::StructuralFeature的定义。

当property属于class时,它代表一个attribute。此时,它将一个class的实例和attribute类型的一个值或一组值关联起来。?

当property属于连接(association)时,它表示连接的一个非导向端。此时,property的类型就是连接端的类型。

Property表示通过命名关系将一个或多个实例关联到一个值或多个值的声明状态。当Property为类元的属性(attribute)时,这个值或这些值通过正在槽(slot)中保持的实例联系到类元的实例。当property为连接端时,这个值或这些值关系到连接(association)的另一端的一个或多个实例。


3. Attribute的定义依然存在[3]:

A structural feature of a classifier that characterizes instances of the classifier. An attribute relates an instance of a classifier to a value or values through a named relationship.

?

Attribute是刻画类元实例的结构化特征,一个Attribute通过一个命名关系将类元的实例联系到一个或多个值。

?

-------------------------------------------以下为其他参考--------------------------------------------

4.?Note that an attribute typically corresponds to public properties in a language that supports?properties but to private fields in a language that does not. In a language without properties, you?may see the fields exposed through accessor (getting and setting) methods. A read-only attribute?will have no setting method (with fields) or set action (for properties). Note that if you don't give a?name for a property, it's common to use the name of the target class.[5]


注意:Attribute一般相当于支持properties的语言中的公有properties或不支持properties的语言中的私有字段(Field)。没有properties的编程语言中,需要通过存取器来访问字段,而只读attribute时没有存(set)方法和动作的。如果没有为property命名,它通常就是用目标类的名字。

?

[1].? UML 2.0 Infrastructure Final Adopted Specifcation03-09-15文档111页

[2].? UML 2.0 Infrastructure Final Adopted Specifcation03-09-15文档123页

[3].? UML 2.0 Infrastructure Final Adopted Specifcation03-09-15文档17页

[4].? UML参考手册

[5] . ? UML distilled

热点排行