Benefits:
• It defines class hierarchies consisting of primitive and complex objects.
• It makes it easier for you to add new kinds of components.
• It provides the flexibility of structure with a manageable interface.
Applicable Scenarios:
• You want to represent a full or partial hierarchy of objects.
• You want clients to be able to ignore the differences between the varying objects in the hierarchy.
• The structure is dynamic and can have any level of complexity: for example, using the Composite view from the J2EE Patterns Catalog, which is useful for portal applications.
博客介绍了定义由基本和复杂对象组成的类层次结构的好处,包括便于添加新组件、提供灵活结构与可管理接口。还说明了适用场景,如表示对象层次结构、让客户端忽略对象差异,以及适用于动态且复杂的结构,如J2EE模式目录的复合视图用于门户应用。
1023

被折叠的 条评论
为什么被折叠?



