资讯专栏INFORMATION COLUMN

Association, Composition and Aggregation in UI5, C

fuchenxuan / 1104人阅读

摘要:使用和描述控件之间的关系。的含义同里的,而的含义同和中的一致。的这两种多了一个限制的目标必须和源在同一个部署单元,或者目标位于部署单元内。

UI5

UI5使用Association和Aggregation描述控件之间的关系。

Aggregation:parent和子控件在lifecycle上存在依赖关系:

When a ManagedObject is destroyed, all aggregated objects are destroyed as well and the object itself is removed from its parent. That is, aggregations won"t contain destroyed objects or null/undefined.

比如UI5的转盘控件Carousel: 一旦转盘被析构,里面显示的page当然也没有继续存在的意义了,需要跟着被析构。

而Association描述了在lifecycle层面的一种soft dependency关系:

Managed associations also form a relationship between objects, but they don"t define a lifecycle for the associated objects. They even can "break" in the sense that an associated object might have been destroyed already although it is still referenced in an association. 

最明显的例子就是控件和其label的关系,比如button和label:技术上来说,可以彼此分开独立存在。

CRM

CRM的Genil model存在三种类型的relation,可以在doman CRM_RELATION_KIND里查看:

区别:

Association: Link between any kind of objects. Can also be defined across components with root or access object as target. 依赖关系最为loose的一种relation,可以用来连接跨model之间的节点。

Aggregation: Binds child objects to a root object. Only access and dependent objects can be aggregated. 只适用于同一模型的节点之间的关联。

Composition: Like an aggregation, but composed child objects always exist. 特殊类型的Aggregation。目标节点的Cardinality为1或者1..n

S/4HANA

只有两种:association或者composition。Composition的含义同CRM里的aggregation,而association的含义同UI5和CRM中的association一致。

C4C

只有两种: association或者composition。C4C的这两种relation多了一个限制:relation的目标BO必须和源BO在同一个部署单元Deployment Unit,或者目标BO位于Foundation部署单元内。

Association的语法如下图:

association的multiplicity只支持[0,1]或者[1,1], 如果不显式指定,默认为[1,1].

C4C relation的一个特色是,一旦申明了一个子节点之后,系统会默认生成一个对应的composition。

下图第4行代码会自动生成一个[0,n]的从root节点到Item节点的composition。

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/52149.html

相关文章

  • Association, Composition and Aggregation in UI5, C

    摘要:使用和描述控件之间的关系。的含义同里的,而的含义同和中的一致。的这两种多了一个限制的目标必须和源在同一个部署单元,或者目标位于部署单元内。 UI5 UI5使用Association和Aggregation描述控件之间的关系。 Aggregation:parent和子控件在lifecycle上存在依赖关系: When a ManagedObject is destroyed, all a...

    HmyBmny 评论0 收藏0
  • Association, Composition and Aggregation in UI5, C

    摘要:使用和描述控件之间的关系。的含义同里的,而的含义同和中的一致。的这两种多了一个限制的目标必须和源在同一个部署单元,或者目标位于部署单元内。 UI5 UI5使用Association和Aggregation描述控件之间的关系。 Aggregation:parent和子控件在lifecycle上存在依赖关系: When a ManagedObject is destroyed, all a...

    Crazy_Coder 评论0 收藏0
  • 从零开始单排学设计模式「UML类图」定级赛

    摘要:从零开始单排学设计模式的国服排位之旅,今天正式开启目前段位定级赛这篇文章来总结下类图,本来不打算讲类图的,因为我在学习设计模式的时候,一遇到有关的就会自动忽略,一看感觉就很复杂。关联关系用实现箭头来表示。 阅读本文大概需要 3.5 分钟。 本篇是设计模式系列的开篇,虽然之前也写过相应的文章,但是因为种种原因后来断掉了,而且发现之前写的内容也很渣,不够系统。 所以现在打算重写,加上距离现...

    Loong_T 评论0 收藏0
  • 《设计模式》1.绪论

    摘要:设计模式是一套被反复使用的多数人知晓的经过分类编目的代码设计经验的总结。使用设计模式是为了重用代码让代码更容易被他人理解保证代码可靠性。由此可见,其实设计模式就是从大型软件架构出发便于升级和维护的软件设计思想,它强调降低依赖,降低耦合。 点击进入我的博客 1.1 设计模式概述 什么是设计模式 设计模式是软件开发人员在软件开发过程中面临的一般问题的解决方案。设计模式是一套被反复使用的、...

    bovenson 评论0 收藏0

发表评论

0条评论

fuchenxuan

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<