當前位置: 首頁>>代碼示例>>Java>>正文


Java ManagedList類代碼示例

本文整理匯總了Java中org.springframework.beans.factory.support.ManagedList的典型用法代碼示例。如果您正苦於以下問題:Java ManagedList類的具體用法?Java ManagedList怎麽用?Java ManagedList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ManagedList類屬於org.springframework.beans.factory.support包,在下文中一共展示了ManagedList類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addRefIfNeeded

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private void addRefIfNeeded(Object v, List<String> refs) {
         if(v == null) return;
         
         if(v instanceof RuntimeBeanReference) {
            RuntimeBeanReference r = (RuntimeBeanReference)v;
            String name = r.getBeanName();
            
            addRefIfNeeded(name, refs);
            
            if(name == null || name.length() == 0) {
               System.err.println("Warning - empty reference " + r);
            }
         } else if(v instanceof BeanDefinitionHolder) {
            // Nested bean definition
            BeanDefinitionHolder bdh = (BeanDefinitionHolder)v;
            processBeanDefinition(bdh.getBeanName(), bdh.getBeanDefinition());
         } else if(v instanceof ManagedList<?>) {
            ManagedList<?> ml = (ManagedList<?>)v;
            for(Object le : ml) {
               addRefIfNeeded(le, refs);
            }
//       } else {
//          System.err.println(v.getClass());
         }
      }
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:26,代碼來源:ContextDependencyLister.java

示例2: manageListIfNecessary

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
/**
 * Checks whether there are any {@link RuntimeBeanReference}s inside the List
 * and converts it to a ManagedList if necessary.
 * @param list the original List
 * @return either the original list or a managed copy of it
 */
private Object manageListIfNecessary(List<?> list) {
	boolean containsRuntimeRefs = false;
	for (Object element : list) {
		if (element instanceof RuntimeBeanReference) {
			containsRuntimeRefs = true;
			break;
		}
	}
	if (containsRuntimeRefs) {
		List<Object> managedList = new ManagedList<Object>();
		managedList.addAll(list);
		return managedList;
	}
	return list;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:GroovyBeanDefinitionReader.java

示例3: addIncludePatterns

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private void addIncludePatterns(Element element, ParserContext parserContext, BeanDefinition beanDef) {
	ManagedList<TypedStringValue> includePatterns = new ManagedList<TypedStringValue>();
	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node node = childNodes.item(i);
		if (node instanceof Element) {
			Element includeElement = (Element) node;
			TypedStringValue valueHolder = new TypedStringValue(includeElement.getAttribute("name"));
			valueHolder.setSource(parserContext.extractSource(includeElement));
			includePatterns.add(valueHolder);
		}
	}
	if (!includePatterns.isEmpty()) {
		includePatterns.setSource(parserContext.extractSource(element));
		beanDef.getPropertyValues().add("includePatterns", includePatterns);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:AspectJAutoProxyBeanDefinitionParser.java

示例4: parse

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
public BeanDefinition parse(Element element, ParserContext parserContext)
{
    BeanDefinitionBuilder dwrController = BeanDefinitionBuilder.rootBeanDefinition(DwrController.class);
    List configurators = new ManagedList();
    configurators.add(new RuntimeBeanReference(DEFAULT_SPRING_CONFIGURATOR_ID));
    dwrController.addPropertyValue("configurators", configurators);

    String debug = element.getAttribute("debug");
    if (StringUtils.hasText(debug))
    {
        dwrController.addPropertyValue("debug", debug);
    }

    String beanName = element.getAttribute(BeanDefinitionParserDelegate.ID_ATTRIBUTE);
    String nameAttr = element.getAttribute(BeanDefinitionParserDelegate.NAME_ATTRIBUTE);
    String[] aliases = null;
    if (!StringUtils.hasText(beanName))
    {
        beanName = element.getAttribute("name");
    }
    else
    {
        String aliasName = element.getAttribute("name");
        if (StringUtils.hasText(aliasName))
        {
            aliases = StringUtils.tokenizeToStringArray(nameAttr, BeanDefinitionParserDelegate.BEAN_NAME_DELIMITERS);
        }
    }

    parseControllerParameters(dwrController, element);
    
    BeanDefinitionHolder holder = new BeanDefinitionHolder(dwrController.getBeanDefinition(), beanName, aliases);
    BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());

    return dwrController.getBeanDefinition();
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:37,代碼來源:DwrNamespaceHandler.java

示例5: parseServerConfig

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private String parseServerConfig(Element element, ParserContext parserContext) {
Element ipconfigs = DomUtils.getChildElementByTagName(element, AttributeNames.IPCONFIGS);
List<Element> ips = DomUtils.getChildElementsByTagName(ipconfigs, AttributeNames.IPCONFIG);
BeanDefinitionBuilder serverConfigBuilder = BeanDefinitionBuilder.genericBeanDefinition(ServerConfig.class);
serverConfigBuilder.addConstructorArgValue(element.getAttribute(AttributeNames.READ_SIZE));
serverConfigBuilder.addConstructorArgValue(element.getAttribute(AttributeNames.WRITE_SIZE));
ManagedList<BeanDefinition> inetSocketAddress = new ManagedList<BeanDefinition>();
for (Element ip : ips) {
    BeanDefinitionBuilder inetBuilder = BeanDefinitionBuilder.genericBeanDefinition(IpConfig.class);
    inetBuilder.addConstructorArgValue(ip.getAttribute(AttributeNames.HOST_NAME));
    inetBuilder.addConstructorArgValue(ip.getAttribute(AttributeNames.PORT));
    inetSocketAddress.add(inetBuilder.getBeanDefinition());
}
serverConfigBuilder.addConstructorArgValue(inetSocketAddress);
String serverConfig = StringUtils.uncapitalize(ServerConfig.class.getSimpleName());
parserContext.getRegistry().registerBeanDefinition(serverConfig, serverConfigBuilder.getBeanDefinition());
return serverConfig;
   }
 
開發者ID:ilivoo,項目名稱:game,代碼行數:19,代碼來源:NioServerBeanDefinitionParser.java

示例6: doParse

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked")
protected void doParse(Element element, BeanDefinitionBuilder dwrController)
{
    List<Object> configurators = new ManagedList();
    configurators.add(new RuntimeBeanReference(ConfigurationParser.DEFAULT_SPRING_CONFIGURATOR_ID));
    dwrController.addPropertyValue("configurators", configurators);

    String debug = element.getAttribute("debug");
    if (StringUtils.hasText(debug))
    {
        dwrController.addPropertyValue("debug", debug);
    }

    parseControllerParameters(dwrController, element);

}
 
開發者ID:directwebremoting,項目名稱:dwr,代碼行數:18,代碼來源:ControllerParser.java

示例7: manageListIfNecessary

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
/**
 * Checks whether there are any {@link RuntimeBeanReference}s inside the {@link List}
 * and converts it to a {@link ManagedList} if necessary.
 * @param list the original List
 * @return either the original list or a managed copy of it
 */
private Object manageListIfNecessary(List<?> list) {
	boolean containsRuntimeRefs = false;
	for (Object element : list) {
		if (element instanceof RuntimeBeanReference) {
			containsRuntimeRefs = true;
			break;
		}
	}
	if (containsRuntimeRefs) {
		List<Object> managedList = new ManagedList<Object>();
		managedList.addAll(list);
		return managedList;
	}
	return list;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:22,代碼來源:GroovyBeanDefinitionReader.java

示例8: createContentNegotiatingViewResolver

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private BeanDefinition createContentNegotiatingViewResolver(Element resolverElement, ParserContext context) {
	RootBeanDefinition beanDef = new RootBeanDefinition(ContentNegotiatingViewResolver.class);
	beanDef.setSource(context.extractSource(resolverElement));
	beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
	MutablePropertyValues values = beanDef.getPropertyValues();

	List<Element> elements = DomUtils.getChildElementsByTagName(resolverElement, new String[] {"default-views"});
	if (!elements.isEmpty()) {
		ManagedList<Object> list = new ManagedList<Object>();
		for (Element element : DomUtils.getChildElementsByTagName(elements.get(0), "bean", "ref")) {
			list.add(context.getDelegate().parsePropertySubElement(element, null));
		}
		values.add("defaultViews", list);
	}
	if (resolverElement.hasAttribute("use-not-acceptable")) {
		values.add("useNotAcceptableStatusCode", resolverElement.getAttribute("use-not-acceptable"));
	}
	Object manager = getContentNegotiationManager(context);
	if (manager != null) {
		values.add("contentNegotiationManager", manager);
	}
	return beanDef;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:24,代碼來源:ViewResolversBeanDefinitionParser.java

示例9: parseResourceChain

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private void parseResourceChain(RootBeanDefinition resourceHandlerDef, ParserContext parserContext,
		Element element, Object source) {

	String autoRegistration = element.getAttribute("auto-registration");
	boolean isAutoRegistration = !(StringUtils.hasText(autoRegistration) && "false".equals(autoRegistration));

	ManagedList<? super Object> resourceResolvers = new ManagedList<Object>();
	resourceResolvers.setSource(source);
	ManagedList<? super Object> resourceTransformers = new ManagedList<Object>();
	resourceTransformers.setSource(source);

	parseResourceCache(resourceResolvers, resourceTransformers, element, source);
	parseResourceResolversTransformers(isAutoRegistration, resourceResolvers, resourceTransformers,
			parserContext, element, source);

	if (!resourceResolvers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceResolvers", resourceResolvers);
	}
	if (!resourceTransformers.isEmpty()) {
		resourceHandlerDef.getPropertyValues().add("resourceTransformers", resourceTransformers);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:23,代碼來源:ResourcesBeanDefinitionParser.java

示例10: getCallableInterceptors

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private ManagedList<?> getCallableInterceptors(Element element, Object source, ParserContext parserContext) {
	ManagedList<? super Object> interceptors = new ManagedList<Object>();
	Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
	if (asyncElement != null) {
		Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "callable-interceptors");
		if (interceptorsElement != null) {
			interceptors.setSource(source);
			for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) {
				BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
				beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
				interceptors.add(beanDef);
			}
		}
	}
	return interceptors;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:17,代碼來源:AnnotationDrivenBeanDefinitionParser.java

示例11: getDeferredResultInterceptors

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private ManagedList<?> getDeferredResultInterceptors(Element element, Object source, ParserContext parserContext) {
	ManagedList<? super Object> interceptors = new ManagedList<Object>();
	Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
	if (asyncElement != null) {
		Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "deferred-result-interceptors");
		if (interceptorsElement != null) {
			interceptors.setSource(source);
			for (Element converter : DomUtils.getChildElementsByTagName(interceptorsElement, "bean")) {
				BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(converter);
				beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(converter, beanDef);
				interceptors.add(beanDef);
			}
		}
	}
	return interceptors;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:17,代碼來源:AnnotationDrivenBeanDefinitionParser.java

示例12: wrapLegacyResolvers

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
private ManagedList<Object> wrapLegacyResolvers(List<Object> list, ParserContext context) {
	ManagedList<Object> result = new ManagedList<Object>();
	for (Object object : list) {
		if (object instanceof BeanDefinitionHolder) {
			BeanDefinitionHolder beanDef = (BeanDefinitionHolder) object;
			String className = beanDef.getBeanDefinition().getBeanClassName();
			Class<?> clazz = ClassUtils.resolveClassName(className, context.getReaderContext().getBeanClassLoader());
			if (WebArgumentResolver.class.isAssignableFrom(clazz)) {
				RootBeanDefinition adapter = new RootBeanDefinition(ServletWebArgumentResolverAdapter.class);
				adapter.getConstructorArgumentValues().addIndexedArgumentValue(0, beanDef);
				result.add(new BeanDefinitionHolder(adapter, beanDef.getBeanName() + "Adapter"));
				continue;
			}
		}
		result.add(object);
	}
	return result;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:19,代碼來源:AnnotationDrivenBeanDefinitionParser.java

示例13: doParse

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder beanDefinitionBuilder) {
	String contextPath = element.getAttribute("context-path");
	if (!StringUtils.hasText(contextPath)) {
		// Backwards compatibility with 3.x version of the xsd
		contextPath = element.getAttribute("contextPath");
	}
	if (StringUtils.hasText(contextPath)) {
		beanDefinitionBuilder.addPropertyValue("contextPath", contextPath);
	}

	List<Element> classes = DomUtils.getChildElementsByTagName(element, "class-to-be-bound");
	if (!classes.isEmpty()) {
		ManagedList<String> classesToBeBound = new ManagedList<String>(classes.size());
		for (Element classToBeBound : classes) {
			String className = classToBeBound.getAttribute("name");
			classesToBeBound.add(className);
		}
		beanDefinitionBuilder.addPropertyValue("classesToBeBound", classesToBeBound);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:22,代碼來源:Jaxb2MarshallerBeanDefinitionParser.java

示例14: testPrototypeWithArrayConversionForConstructor

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
@Test
public void testPrototypeWithArrayConversionForConstructor() {
	DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
	List<String> list = new ManagedList<String>();
	list.add("myName");
	list.add("myBeanName");
	RootBeanDefinition bd = new RootBeanDefinition(DerivedTestBean.class);
	bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
	bd.getConstructorArgumentValues().addGenericArgumentValue(list);
	lbf.registerBeanDefinition("test", bd);
	DerivedTestBean tb = (DerivedTestBean) lbf.getBean("test");
	assertEquals("myName", tb.getName());
	assertEquals("myBeanName", tb.getBeanName());
	DerivedTestBean tb2 = (DerivedTestBean) lbf.getBean("test");
	assertTrue(tb != tb2);
	assertEquals("myName", tb2.getName());
	assertEquals("myBeanName", tb2.getBeanName());
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:19,代碼來源:DefaultListableBeanFactoryTests.java

示例15: testPrototypeWithArrayConversionForFactoryMethod

import org.springframework.beans.factory.support.ManagedList; //導入依賴的package包/類
@Test
public void testPrototypeWithArrayConversionForFactoryMethod() {
	DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
	List<String> list = new ManagedList<String>();
	list.add("myName");
	list.add("myBeanName");
	RootBeanDefinition bd = new RootBeanDefinition(DerivedTestBean.class);
	bd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
	bd.setFactoryMethodName("create");
	bd.getConstructorArgumentValues().addGenericArgumentValue(list);
	lbf.registerBeanDefinition("test", bd);
	DerivedTestBean tb = (DerivedTestBean) lbf.getBean("test");
	assertEquals("myName", tb.getName());
	assertEquals("myBeanName", tb.getBeanName());
	DerivedTestBean tb2 = (DerivedTestBean) lbf.getBean("test");
	assertTrue(tb != tb2);
	assertEquals("myName", tb2.getName());
	assertEquals("myBeanName", tb2.getBeanName());
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:20,代碼來源:DefaultListableBeanFactoryTests.java


注:本文中的org.springframework.beans.factory.support.ManagedList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。