protected <T> BeanDefinitionBase createBeanDefinition(Class<T> type, T bean, String name, boolean primary){ BeanDefinitionBase bd = new BeanDefinitionBase(XmlBeanDefinitionLoader.RUNTIME_SOURCE); bd.setName(name); bd.setType(type); bd.setBeanClass(bean.getClass()); bd.setSingleton(true); bd.setSingletonInstance(bean); bd.setPrimary(primary); return bd; }
protected BeanDefinitionBase create(Class<?> type, Class<?> beanClass) { BeanDefinitionBase bd = new BeanDefinitionBase(XmlBeanDefinitionLoader.RUNTIME_SOURCE); bd.setType(type); bd.setBeanClass(beanClass); bd.setBeanClassType(BeanType.of(beanClass)); bd.setSingleton(true); bd.setPrimary(true); return bd; }
protected BeanDefinitionBase create(Class<?> type, Class<?> beanClass, String name) { BeanDefinitionBase bd = new BeanDefinitionBase(XmlBeanDefinitionLoader.RUNTIME_SOURCE); bd.setName(name); bd.setType(type); bd.setBeanClass(beanClass); bd.setBeanClassType(BeanType.of(beanClass)); bd.setSingleton(true); return bd; }
protected <T> BeanDefinitionBase createBeanDefinition(Class<T> type, String name){ BeanDefinitionBase bd = new BeanDefinitionBase(XmlBeanDefinitionLoader.RUNTIME_SOURCE); bd.setType(type); bd.setName(name); bd.setBeanClass(type); bd.setBeanClassType(BeanType.of(type)); bd.setSingleton(true); bd.setPrimary(Strings.isEmpty(name) ? true : false); return bd; }
protected BeanDefinitionBase readSetBean(BeanContainer container, XmlReader reader, LoaderContext context) { BeanDefinitionBase bean = new BeanDefinitionBase(reader.getSource()); readValuedBeanAttributes(container, reader, context, bean); bean.setBeanClass(classAttribute(reader, SET_CLASS_ATTRIBUTE, false)); bean.setValueDefinition(readSet(container, reader, context)); bean.getValueDefinition().setDefinedType(bean.getBeanClass()); if (null == bean.getBeanClass()) { bean.setBeanClass(LinkedHashSet.class); } return bean; }
protected BeanDefinitionBase readMapBean(BeanContainer container, XmlReader reader, LoaderContext context) { BeanDefinitionBase bean = new BeanDefinitionBase(reader.getSource()); readValuedBeanAttributes(container, reader, context, bean); bean.setBeanClass(classAttribute(reader, MAP_CLASS_ATTRIBUTE, false)); bean.setValueDefinition(readMap(container, reader, context)); bean.getValueDefinition().setDefinedType(bean.getBeanClass()); if (null == bean.getBeanClass()) { bean.setBeanClass(LinkedHashMap.class); } return bean; }
protected BeanDefinitionBase readListBean(BeanContainer container, XmlReader reader, LoaderContext context) { BeanDefinitionBase bean = new BeanDefinitionBase(reader.getSource()); readValuedBeanAttributes(container, reader, context, bean); bean.setBeanClass(classAttribute(reader, LIST_CLASS_ATTRIBUTE, false)); bean.setValueDefinition(readList(container, reader, context)); bean.getValueDefinition().setDefinedType(bean.getBeanClass()); if (null == bean.getBeanClass()) { bean.setBeanClass(ArrayList.class); } return bean; }
public <T> BeanDefinitionBase create(String id, Class<? super T> typeClass, boolean primary, String name, boolean lazyInit, Class<?> beanClass, Object... constructorArguments) { BeanDefinitionBase bd = new BeanDefinitionBase(RUNTIME_SOURCE); bd.setId(id); bd.setName(name); bd.setType(typeClass); bd.setBeanClass(beanClass); bd.setBeanClassType(BeanType.of(beanClass)); bd.setPrimary(primary); bd.setSingleton(true); bd.setLazyInit(lazyInit); for (Object arg : constructorArguments) { bd.addConstructorArgument(new ArgumentDefinition(new ValueDefinition(arg))); } resolveBeanConstructor(bd); return bd; }
protected void readBean(BeanContainer container,Class<?> cls){ Bean a = cls.getAnnotation(Bean.class); BeanDefinitionBase bd = new BeanDefinitionBase(Classes.getClassResourcePath(cls)); bd.setAnnotation(true); if(!Strings.isEmpty(a.value())) {
BeanDefinitionBase bean = new BeanDefinitionBase(reader.getSource());