public static BeanRule newOfferedBeanInstance( String id, String offerBeanId, String offerMethodName, String initMethodName, String destroyMethodName, String factoryMethodName, String scope, Boolean singleton, Boolean lazyInit, Boolean important) { if (offerBeanId == null || offerMethodName == null) { throw new IllegalArgumentException( "The 'bean' element requires both 'offerBean' attribute and 'offerMethod' attribute."); } ScopeType scopeType = ScopeType.resolve(scope); if (scope != null && scopeType == null) { throw new IllegalArgumentException("No scope type registered for '" + scope + "'."); } if (scopeType == null) { scopeType = (singleton == null || singleton == Boolean.TRUE) ? ScopeType.SINGLETON : ScopeType.PROTOTYPE; } BeanRule beanRule = new BeanRule(); beanRule.setId(id); beanRule.setScopeType(scopeType); beanRule.setSingleton(singleton); beanRule.setOfferBeanId(offerBeanId); beanRule.setOfferMethodName(offerMethodName); beanRule.setOffered(true); beanRule.setInitMethodName(initMethodName); beanRule.setDestroyMethodName(destroyMethodName); beanRule.setFactoryMethodName(factoryMethodName); beanRule.setLazyInit(lazyInit); beanRule.setImportant(important); return beanRule; }
public static BeanRule replicate(BeanRule beanRule) { BeanRule br = new BeanRule(); br.setId(beanRule.getId()); if (beanRule.getScanPattern() == null) { br.setBeanClass(beanRule.getBeanClass()); } br.setScopeType(beanRule.getScopeType()); br.setSingleton(beanRule.getSingleton()); br.setOfferBeanId(beanRule.getOfferBeanId()); br.setOfferMethodName(beanRule.getOfferMethodName()); br.setInitMethodName(beanRule.getInitMethodName()); br.setDestroyMethodName(beanRule.getDestroyMethodName()); br.setFactoryMethodName(beanRule.getFactoryMethodName()); br.setConstructorArgumentItemRuleMap(beanRule.getConstructorArgumentItemRuleMap()); br.setPropertyItemRuleMap(beanRule.getPropertyItemRuleMap()); br.setLazyInit(beanRule.getLazyInit()); br.setImportant(beanRule.getImportant()); br.setDescription(beanRule.getDescription()); br.setReplicated(true); return br; }