java object toarray_Java ObjectUtils.addObjectToArray方法代碼示例

import org.springframework.util.ObjectUtils; //導入方法依賴的package包/類

/**

* Prepare the script beans in the internal BeanFactory that this

* post-processor uses. Each original bean definition will be split

* into a ScriptFactory definition and a scripted object definition.

* @param bd the original bean definition in the main BeanFactory

* @param scriptFactoryBeanName the name of the internal ScriptFactory bean

* @param scriptedObjectBeanName the name of the internal scripted object bean

*/

protected void prepareScriptBeans(BeanDefinition bd, String scriptFactoryBeanName, String scriptedObjectBeanName) {

// Avoid recreation of the script bean definition in case of a prototype.

synchronized (this.scriptBeanFactory) {

if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) {

this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName,

createScriptFactoryBeanDefinition(bd));

ScriptFactory scriptFactory = this.scriptBeanFactory

.getBean(scriptFactoryBeanName, ScriptFactory.class);

ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName,

scriptFactory.getScriptSourceLocator());

Class>[] interfaces = scriptFactory.getScriptInterfaces();

Class>[] scriptedInterfaces = interfaces;

if (scriptFactory.requiresConfigInterface() && !bd.getPropertyValues().isEmpty()) {

Class> configInterface = createConfigInterface(bd, interfaces);

scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface);

}

BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource,

scriptedInterfaces);

long refreshCheckDelay = resolveRefreshCheckDelay(bd);

if (refreshCheckDelay >= 0) {

objectBd.setScope(BeanDefinition.SCOPE_PROTOTYPE);

}

this.scriptBeanFactory.registerBeanDefinition(scriptedObjectBeanName, objectBd);

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值