XAggregation
From Apache OpenOffice Wiki
< Zh | Documentation
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
聚合的概念通常用于将多个对象插在一起,以在运行时形成一个对象。这时要用到的主接口是 com.sun.star.uno.XAggregation。对象合在一起之后,引用计数和 queryInterface() 方法从多个从属对象委派到一个主对象。
聚合时的前提条件是,从属对象的引用计数恰好为一,即主对象的引用计数。而且,它对代理对象不起作用,因为在 Java 中,同一个从属对象的同一接口可能存在多个代理对象。
虽然与实现继承相比,聚合允许更多的代码重用,但是上述情况加上独立对象的实现会使得编程很容易出错。因此,不提倡使用这种概念,这里也不再赘述。如果需要更多信息,请访问 http://udk.openoffice.org/common/man/concept/unointro.html#aggregation。
| Content on this page is licensed under the Public Documentation License (PDL). |