本文整理汇总了Java中org.springframework.beans.factory.support.ManagedSet.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedSet.setSource方法的具体用法?Java ManagedSet.setSource怎么用?Java ManagedSet.setSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.support.ManagedSet
的用法示例。
在下文中一共展示了ManagedSet.setSource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseSetElement
import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
/**
* Parse a set element.
*/
public Set<?> parseSetElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(BeanDefinitionParserDelegate.VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedSet<Object> target = new ManagedSet<Object>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
parseCollectionElements(nl, target, bd, defaultElementType);
return target;
}
示例2: parseSetElement
import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
/**
* Parse a set element.
*/
public Set<Object> parseSetElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedSet<Object> target = new ManagedSet<Object>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
parseCollectionElements(nl, target, bd, defaultElementType);
return target;
}
示例3: shallowCloneManagedCollections
import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的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);
}
}
}
示例4: parseSetElement
import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
/**
* Parse a set element.
*/
public Set parseSetElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedSet<Object> target = new ManagedSet<Object>(nl.getLength());
target.setSource(extractSource(collectionEle));
target.setElementTypeName(defaultElementType);
target.setMergeEnabled(parseMergeAttribute(collectionEle));
parseCollectionElements(nl, target, bd, defaultElementType);
return target;
}
示例5: handleSetValues
import org.springframework.beans.factory.support.ManagedSet; //导入方法依赖的package包/类
protected Object handleSetValues(final PropertyValue configuredValue)
{
final Object value;
LOGGER.debug("[{}] Set of values / bean reference names has been configured - treating property {} of {} as <set>", this.beanName,
this.propertyName, this.targetBeanName);
final ManagedSet<Object> set = new ManagedSet<>();
if (this.merge && configuredValue != null)
{
final Object configuredValueDefinition = configuredValue.getValue();
if (configuredValueDefinition instanceof ManagedSet<?>)
{
final ManagedSet<?> oldSet = (ManagedSet<?>) configuredValueDefinition;
set.setElementTypeName(oldSet.getElementTypeName());
set.setMergeEnabled(oldSet.isMergeEnabled());
set.setSource(oldSet.getSource());
set.addAll(oldSet);
LOGGER.debug("[{}] Merged existing value set values: {}", this.beanName, oldSet);
}
}
Set<Object> valuesToAdd;
if (this.valueSet != null)
{
LOGGER.debug("[{}] Set of configured values for {} of {}: ", this.beanName, this.propertyName, this.targetBeanName,
this.valueSet);
valuesToAdd = this.valueSet;
}
else
{
LOGGER.debug("[{}] Set of configured bean reference names for {} of {}: ", this.beanName, this.propertyName,
this.targetBeanName, this.beanReferenceNameSet);
valuesToAdd = new HashSet<>();
for (final String beanReferenceName : this.beanReferenceNameSet)
{
valuesToAdd.add(new RuntimeBeanReference(beanReferenceName));
}
}
LOGGER.debug("[{}] Adding new entries to set for {} of {}", this.beanName, this.propertyName, this.targetBeanName);
set.addAll(valuesToAdd);
if (!set.isMergeEnabled() && this.mergeParent)
{
LOGGER.debug("[{}] Enabling \"merge\" for <set> on {} of {}", this.beanName, this.propertyName, this.targetBeanName);
}
set.setMergeEnabled(set.isMergeEnabled() || this.mergeParent);
value = set;
return value;
}