本文整理汇总了Java中org.springframework.beans.factory.support.ManagedSet类的典型用法代码示例。如果您正苦于以下问题:Java ManagedSet类的具体用法?Java ManagedSet怎么用?Java ManagedSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ManagedSet类属于org.springframework.beans.factory.support包,在下文中一共展示了ManagedSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertClassesToStrings
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
/**
* Utility method used for maintaining backwards compatibility by converting Class objects to String (using their
* class names). Used by importer and exporter parsing to set the 'interfaces' property.
*
* @param parsedClasses collection of parsed classes
* @return a collection of converted (if necessary) metadata
*/
public static Set<?> convertClassesToStrings(Set<?> parsedClasses) {
Set<Object> interfaces = new ManagedSet<Object>(parsedClasses.size());
for (Object clazz : parsedClasses) {
if (clazz instanceof TypedStringValue || clazz instanceof String) {
interfaces.add(clazz);
} else {
// add adapter definition for bean references (which can be classes)
interfaces.add(BeanDefinitionBuilder.genericBeanDefinition(ToStringClassAdapter.class)
.addConstructorArgValue(clazz).getBeanDefinition());
}
}
return interfaces;
}
示例2: getInititalEntityClasses
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
private static Set<String> getInititalEntityClasses(String[] domainPackages) {
if (ArrayUtils.isEmpty(domainPackages)) {
return null;
}
ClassPathScanningCandidateComponentProvider componentProvider = new ClassPathScanningCandidateComponentProvider(false);
componentProvider.addIncludeFilter(new AnnotationTypeFilter(Document.class));
componentProvider.addIncludeFilter(new AnnotationTypeFilter(Persistent.class));
Set<String> classes = new ManagedSet<>();
for (String domainPackage : domainPackages) {
if (StringUtils.isBlank(domainPackage)) {
continue;
}
for (BeanDefinition candidate : componentProvider.findCandidateComponents(domainPackage)) {
classes.add(candidate.getBeanClassName());
}
}
return classes;
}
示例3: parseSet
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
/**
* Parses a list of elements into a set of beans/standard content.
*
* @param grandChildren - The set of beans/content in a bean property
* @param child - The property tag for the parent.
* @param parent - The parent bean that the tag is nested in.
* @param parserContext - Provided information and functionality regarding current bean set.
* @return A managedSet of the nested content.
*/
protected ManagedSet parseSet(ArrayList<Element> grandChildren, Element child, BeanDefinitionBuilder parent,
ParserContext parserContext) {
ManagedSet setItems = new ManagedSet();
for (int i = 0; i < grandChildren.size(); i++) {
Element grandChild = grandChildren.get(i);
if (child.getTagName().compareTo("value") == 0) {
setItems.add(grandChild.getTextContent());
} else {
setItems.add(parseBean(grandChild, parent, parserContext));
}
}
String merge = child.getAttribute("merge");
if (merge != null) {
setItems.setMergeEnabled(Boolean.valueOf(merge));
}
return setItems;
}
示例4: visitSet
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
/**
* Iterates through the set values and calls helpers to process the value
*
* @param setVal the set to process
* @param propertyName name of the property which has the set value
* @param nestedBeanStack stack of bean containers which contains the set property
*/
protected void visitSet(Set setVal, String propertyName, Stack<BeanDefinitionHolder> nestedBeanStack) {
boolean isMergeEnabled = false;
if (setVal instanceof ManagedSet) {
isMergeEnabled = ((ManagedSet) setVal).isMergeEnabled();
}
ManagedSet newSet = new ManagedSet();
newSet.setMergeEnabled(isMergeEnabled);
for (Object elem : setVal) {
if (isStringValue(elem)) {
elem = processSetStringPropertyValue(propertyName, setVal, getString(elem), nestedBeanStack,
beanProcessors);
} else {
elem = visitPropertyValue(propertyName, elem, nestedBeanStack);
}
newSet.add(elem);
}
setVal.clear();
setVal.addAll(newSet);
}
示例5: parseLogsElement
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
private void parseLogsElement(Element logsElement, BeanDefinitionBuilder factory, ParserContext ctx) {
if (logsElement == null) {
return;
}
List<Element> childElements = DomUtils.getChildElementsByTagName(logsElement, "log");
ManagedSet<BeanDefinition> logs = new ManagedSet<BeanDefinition>(childElements.size());
for (Element element : childElements) {
BeanDefinition bd = ctx.getRegistry().getBeanDefinition(element.getAttribute("ref"));
if (bd != null) {
logs.add(bd);
}
}
if (logs.size() != 0) {
factory.addPropertyValue("eventLogs", logs);
}
}
示例6: parseFilterManagerElement
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
@Override
public BeanDefinition parseFilterManagerElement(Element filterElement) {
BeanDefinitionBuilder filterManagerFactory = BeanDefinitionBuilder.rootBeanDefinition(SimpleFilterManager.class);
filterManagerFactory.setAutowireMode(RootBeanDefinition.AUTOWIRE_BY_TYPE);
filterManagerFactory.setLazyInit(false);
filterManagerFactory.addPropertyValue("type", getComponentName());
List<Element> itemElements = DomUtils.getChildElementsByTagName(filterElement, "item");
ManagedSet<BeanDefinition> items = new ManagedSet<BeanDefinition>(itemElements.size());
for (Element element : itemElements) {
BeanDefinition bd = parseItemElement(element);
if (bd != null) {
items.add(bd);
}
}
filterManagerFactory.addPropertyValue("filters", items);
return filterManagerFactory.getBeanDefinition();
}
示例7: createStream
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
private XStream createStream() {
XStream stream = new XStream();
stream.registerConverter(new BeanDefinitionConverter(stream.getMapper()));
stream.registerConverter(new BeanDefinitionHolderConverter(stream.getMapper()));
stream.registerConverter(new TypedStringValueConverter());
stream.registerConverter(new ManagedCollectionConverter(stream.getMapper()));
stream.registerConverter(new ManagedMapConverter(stream.getMapper()));
stream.registerConverter(new RuntimeBeanReferenceConverter());
stream.alias("map", ManagedMap.class);
stream.alias("list", ManagedList.class);
stream.alias("set", ManagedSet.class);
stream.alias("array", ManagedArray.class);
stream.aliasType("bean", BeanDefinition.class);
stream.alias("bean", BeanDefinitionHolder.class);
stream.alias("ref", RuntimeBeanReference.class);
return stream;
}
示例8: parseSet
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
/**
* Parses a list of elements into a set of beans/standard content.
*
* @param grandChildren - The set of beans/content in a bean property
* @param child - The property tag for the parent.
* @param parent - The parent bean that the tag is nested in.
* @param parserContext - Provided information and functionality regarding current bean set.
* @return A managedSet of the nested content.
*/
private ManagedSet parseSet(ArrayList<Element> grandChildren, Element child, BeanDefinitionBuilder parent,
ParserContext parserContext) {
ManagedSet setItems = new ManagedSet();
for (int i = 0; i < grandChildren.size(); i++) {
Element grandChild = grandChildren.get(i);
if (child.getTagName().compareTo("spring:value") == 0) {
setItems.add(grandChild.getTextContent());
} else {
setItems.add(parseBean(grandChild, parent, parserContext));
}
}
String merge = child.getAttribute("merge");
if (merge != null) {
setItems.setMergeEnabled(Boolean.valueOf(merge));
}
return setItems;
}
示例9: parseNodeRoles
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
private void parseNodeRoles(BeanDefinitionBuilder def, Element el) {
ManagedSet<String> roles = new ManagedSet<>();
roles.addAll(subElements(el, "roles", "role").stream()
.map(roleEl -> getTextValue(roleEl).trim())
.filter(role -> !role.isEmpty())
.collect(toSet())
);
def.addPropertyValue("roles", roles);
}
示例10: 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;
}
示例11: 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;
}
示例12: parseFilterChain
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
private String parseFilterChain(Element element, ParserContext parserContext) {
Element filterChain = DomUtils.getChildElementByTagName(element, AttributeNames.FILTER_CHAIN);
List<Element> filters = DomUtils.getChildElementsByTagName(filterChain, AttributeNames.FILTER);
BeanDefinitionBuilder filterChainBuilder = BeanDefinitionBuilder.genericBeanDefinition(FilterChain.class);
ManagedSet<BeanDefinition> filterBeanDefinitions = new ManagedSet<BeanDefinition>();
for (Element filter : filters) {
String ref = filter.getAttribute(AttributeNames.REF);
BeanDefinition filterDefinition = parserContext.getRegistry().getBeanDefinition(ref);
filterBeanDefinitions.add(filterDefinition);
}
filterChainBuilder.addConstructorArgValue(filterBeanDefinitions);
String filterChainString = StringUtils.uncapitalize(FilterChain.class.getSimpleName());
parserContext.getRegistry().registerBeanDefinition(filterChainString, filterChainBuilder.getBeanDefinition());
return filterChainString;
}
示例13: updateArrange
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
/**
* 更新手术安排
*
* @param id 手术id
* @param doctor_ids 医生数组
* @param nurse_ids 护士数组
* @param room 房间号
*/
@Override
public void updateArrange(int id, int[] doctor_ids, int[] nurse_ids, int room) {
Surgery surgery = surgeryDao.findById(id);
//设置从申请状态到安排状态
surgery.setState(1);
//Set<Doctor> assists = surgery.getAssists();
// Doctor doctor = new Doctor();
// doctor.setId(1);
// doctor.setName("一拳");
// assists.add(doctor);
// for (Doctor doctor1 : assists) {
// doctor1.setName("只有我不在的");
// }
//重新建立数组,设置医生
Set<Doctor> assists = new ManagedSet<Doctor>();
for (int doctor_id : doctor_ids) {
Doctor doctor = new Doctor();
doctor.setId(doctor_id);
assists.add(doctor);
}
surgery.setAssists(assists);
//设置护士
Set<Nurse> nurses = new ManagedSet<Nurse>();
for (int nurse_id : nurse_ids) {
Nurse nurse = new Nurse();
nurse.setNurseId(nurse_id);
nurses.add(nurse);
}
surgery.setNurses(nurses);
//设置手术室
Operationroom operationroom = new Operationroom();
operationroom.setNum(room);
surgery.setRoom(operationroom);
}
示例14: cancelArrange
import org.springframework.beans.factory.support.ManagedSet; //导入依赖的package包/类
/**
* 取消手术安排
*
* @param id 手术id
*/
public void cancelArrange(int id) {
Surgery surgery = surgeryDao.findById(id);
//设置从安排状态到申请状态
surgery.setState(0);
//重新建立数组,设置医生
Set<Doctor> assists = new ManagedSet<Doctor>();
//设置护士
Set<Nurse> nurses = new ManagedSet<Nurse>();
surgery.setAssists(assists);
surgery.setNurses(nurses);
surgery.setRoom(null);
}
示例15: 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);
}
}
}