ComponentActivatorAbstractBase类(待完善):
由于现理解不够透彻,需要完善翻译及内容等。
/** * Method which tells how many implementations are supported by * the bundle. This way we can tune the number of components * created. * * * @return The list of implementations the bundle will support, * this will be used to decide how many components need to be * created per-container */ protected Object[] getImplementations() { return null; }
getImplementations()函数:
描述该bundle中支持多少实现方法,这样我们就可以调整创建的组件个数。
返回值:该bundle支持的实现方法列表,可以用作说明我们在每个容器里拥有多少个组件。
/** * Configure the dependency for a given instance inside a container * * @param c Component assigned for this instance, this will be * what will be used for configuration * @param imp implementation to be configured * @param containerName container on which the configuration happens */ protected void configureInstance(Component c, Object imp, String containerName) { // do nothing by default }
configureInstance(Component c, Object imp, String containName)函数:
为容器中给定的实例配置依赖
参数c:
参数imp: 需要配置的实现
参数containName: 配置的容器名
(Tip: 在该函数下先检查是否是需要配置的文件,再进行配置)
扫描二维码关注公众号,回复:
799938 查看本文章