本文整理汇总了Java中org.springframework.beans.factory.support.ManagedList.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedList.setSource方法的具体用法?Java ManagedList.setSource怎么用?Java ManagedList.setSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.support.ManagedList
的用法示例。
在下文中一共展示了ManagedList.setSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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;
}
示例4: 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;
}
示例5: createPropertiesList
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
/**
* Creates the list of the properties to be used within the configuration
* from the outer world.
*
* @param element
* the parent element which contains all the properties
* @param parserContext
* the <code>ParserContext</code>
*
* @return the <code>List</code> containing the beans with properties
*/
protected List<?> createPropertiesList(final Element element,
final ParserContext parserContext) {
final List<Element> propEls = DomUtils.getChildElementsByTagName(
element, XML_ELEMENT_PROPERTIES);
// create the list
final ManagedList<Object> list = new ManagedList<Object>(propEls.size());
list.setSource(parserContext.extractSource(element));
list.setElementTypeName(PropertiesLoaderSupport.class.getName());
list.setMergeEnabled(false);
for (final Element propEl : propEls) {
final String loadId = propEl.getAttribute(XML_ATTRIBUTE_LOADID);
final RuntimeBeanReference ref = new RuntimeBeanReference(loadId);
ref.setSource(parserContext.extractSource(propEl));
list.add(ref);
}
return list;
}
示例6: parseListElement
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
/**
* Parse a list element.
*/
public List<?> parseListElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(BeanDefinitionParserDelegate.VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedList<Object> target = new ManagedList<Object>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
parseCollectionElements(nl, target, bd, defaultElementType);
return target;
}
示例7: parseListElement
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
/**
* Parse a list element.
*/
public List<Object> parseListElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedList<Object> target = new ManagedList<Object>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
parseCollectionElements(nl, target, bd, defaultElementType);
return target;
}
示例8: extractBeanSubElements
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<Object> extractBeanSubElements(Element parentElement, ParserContext parserContext) {
ManagedList<Object> list = new ManagedList<Object>();
list.setSource(parserContext.extractSource(parentElement));
for (Element beanElement : DomUtils.getChildElementsByTagName(parentElement, "bean", "ref")) {
Object object = parserContext.getDelegate().parsePropertySubElement(beanElement, null);
list.add(object);
}
return list;
}
示例9: registerMessageConverter
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private RuntimeBeanReference registerMessageConverter(Element element, ParserContext context, Object source) {
Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
ManagedList<? super Object> converters = new ManagedList<Object>();
if (convertersElement != null) {
converters.setSource(source);
for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) {
Object object = context.getDelegate().parsePropertySubElement(beanElement, null);
converters.add(object);
}
}
if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
converters.setSource(source);
converters.add(new RootBeanDefinition(StringMessageConverter.class));
converters.add(new RootBeanDefinition(ByteArrayMessageConverter.class));
if (jackson2Present) {
RootBeanDefinition jacksonConverterDef = new RootBeanDefinition(MappingJackson2MessageConverter.class);
RootBeanDefinition resolverDef = new RootBeanDefinition(DefaultContentTypeResolver.class);
resolverDef.getPropertyValues().add("defaultMimeType", MimeTypeUtils.APPLICATION_JSON);
jacksonConverterDef.getPropertyValues().add("contentTypeResolver", resolverDef);
// Use Jackson factory in order to have JSR-310 and Joda-Time modules registered automatically
GenericBeanDefinition jacksonFactoryDef = new GenericBeanDefinition();
jacksonFactoryDef.setBeanClass(Jackson2ObjectMapperFactoryBean.class);
jacksonFactoryDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
jacksonFactoryDef.setSource(source);
jacksonConverterDef.getPropertyValues().add("objectMapper", jacksonFactoryDef);
converters.add(jacksonConverterDef);
}
}
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addIndexedArgumentValue(0, converters);
RootBeanDefinition messageConverterDef = new RootBeanDefinition(CompositeMessageConverter.class, cavs, null);
return new RuntimeBeanReference(registerBeanDef(messageConverterDef, context, source));
}
示例10: parseBeanSubElements
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
public static ManagedList<? super Object> parseBeanSubElements(Element parentElement, ParserContext context) {
ManagedList<? super Object> beans = new ManagedList<Object>();
if (parentElement != null) {
beans.setSource(context.extractSource(parentElement));
for (Element beanElement : DomUtils.getChildElementsByTagName(parentElement, "bean", "ref")) {
beans.add(context.getDelegate().parsePropertySubElement(beanElement, null));
}
}
return beans;
}
示例11: shallowCloneManagedCollections
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
protected void shallowCloneManagedCollections(final AbstractBeanDefinition cloneBeanDefinition)
{
// clone is not a deep clone - managed lists / maps are by-reference which is problematic for placeholder resolution
final MutablePropertyValues propertyValues = cloneBeanDefinition.getPropertyValues();
for (final PropertyValue pv : propertyValues.getPropertyValues())
{
final Object value = pv.getValue();
if (value instanceof ManagedList<?>)
{
final ManagedList<Object> newList = new ManagedList<>();
newList.setSource(((ManagedList<?>) value).getSource());
newList.setElementTypeName(((ManagedList<?>) value).getElementTypeName());
newList.addAll((ManagedList<?>) value);
propertyValues.add(pv.getName(), newList);
}
else if (value instanceof ManagedSet<?>)
{
final ManagedSet<Object> newSet = new ManagedSet<>();
newSet.setSource(((ManagedSet<?>) value).getSource());
newSet.setElementTypeName(((ManagedSet<?>) value).getElementTypeName());
newSet.addAll((ManagedSet<?>) value);
propertyValues.add(pv.getName(), newSet);
}
else if (value instanceof ManagedMap<?, ?>)
{
final ManagedMap<Object, Object> newMap = new ManagedMap<>();
newMap.setSource(((ManagedMap<?, ?>) value).getSource());
newMap.setKeyTypeName(((ManagedMap<?, ?>) value).getKeyTypeName());
newMap.setValueTypeName(((ManagedMap<?, ?>) value).getValueTypeName());
newMap.putAll((ManagedMap<?, ?>) value);
propertyValues.add(pv.getName(), newMap);
}
}
}
示例12: getMessageConverters
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<?> getMessageConverters(Element element, Object source, ParserContext parserContext) {
Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
ManagedList<? super Object> messageConverters = new ManagedList<Object>();
if (convertersElement != null) {
messageConverters.setSource(source);
for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) {
Object object = parserContext.getDelegate().parsePropertySubElement(beanElement, null);
messageConverters.add(object);
}
}
if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
messageConverters.setSource(source);
messageConverters.add(createConverterDefinition(ByteArrayHttpMessageConverter.class, source));
RootBeanDefinition stringConverterDef = createConverterDefinition(StringHttpMessageConverter.class, source);
stringConverterDef.getPropertyValues().add("writeAcceptCharset", false);
messageConverters.add(stringConverterDef);
messageConverters.add(createConverterDefinition(ResourceHttpMessageConverter.class, source));
messageConverters.add(createConverterDefinition(SourceHttpMessageConverter.class, source));
messageConverters.add(createConverterDefinition(AllEncompassingFormHttpMessageConverter.class, source));
if (romePresent) {
messageConverters.add(createConverterDefinition(AtomFeedHttpMessageConverter.class, source));
messageConverters.add(createConverterDefinition(RssChannelHttpMessageConverter.class, source));
}
if (jaxb2Present) {
messageConverters.add(createConverterDefinition(Jaxb2RootElementHttpMessageConverter.class, source));
}
if (jackson2Present) {
messageConverters.add(createConverterDefinition(MappingJackson2HttpMessageConverter.class, source));
}
else if (jacksonPresent) {
messageConverters.add(createConverterDefinition(MappingJacksonHttpMessageConverter.class, source));
}
}
return messageConverters;
}
示例13: extractBeanSubElements
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private ManagedList<BeanDefinitionHolder> extractBeanSubElements(Element parentElement, ParserContext parserContext) {
ManagedList<BeanDefinitionHolder> list = new ManagedList<BeanDefinitionHolder>();
list.setSource(parserContext.extractSource(parentElement));
for (Element beanElement : DomUtils.getChildElementsByTagName(parentElement, "bean")) {
BeanDefinitionHolder beanDef = parserContext.getDelegate().parseBeanDefinitionElement(beanElement);
beanDef = parserContext.getDelegate().decorateBeanDefinitionIfRequired(beanElement, beanDef);
list.add(beanDef);
}
return list;
}
示例14: parseListElement
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
/**
* Parse a list element.
*/
public List parseListElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedList<Object> target = new ManagedList<Object>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
parseCollectionElements(nl, target, bd, defaultElementType);
return target;
}
示例15: createDefaultCacheFactories
import org.springframework.beans.factory.support.ManagedList; //导入方法依赖的package包/类
private static ManagedList<BeanDefinition> createDefaultCacheFactories(Element element, ParserContext parserContext) {
ManagedList<BeanDefinition> result = new ManagedList<>();
result.setSource(parserContext.extractSource(element));
if (ClassUtils.isPresent("net.spy.memcached.MemcachedClient", parserContext.getReaderContext().getBeanClassLoader())) {
result.add(getCacheFactory(MEMCACHED_FACTORY_CLASS_NAME, element));
}
if (ClassUtils.isPresent("org.springframework.data.redis.connection.RedisConnectionFactory", parserContext.getReaderContext().getBeanClassLoader())) {
result.add(getCacheFactory(REDIS_CONNECTION_FACTORY_CLASS_NAME, element));
}
return result;
}