当前位置: 首页>>代码示例>>Java>>正文


Java CollectionUtils.mergeArrayIntoCollection方法代码示例

本文整理汇总了Java中org.springframework.util.CollectionUtils.mergeArrayIntoCollection方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.mergeArrayIntoCollection方法的具体用法?Java CollectionUtils.mergeArrayIntoCollection怎么用?Java CollectionUtils.mergeArrayIntoCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.util.CollectionUtils的用法示例。


在下文中一共展示了CollectionUtils.mergeArrayIntoCollection方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTestFrameworkBundlesNames

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
protected String[] getTestFrameworkBundlesNames() {
	String[] bundles = super.getTestFrameworkBundlesNames();
	List list = new ArrayList(bundles.length);

	// remove extender
	CollectionUtils.mergeArrayIntoCollection(bundles, list);
	// additionally remove the annotation bundle as well (if included)

	int bundlesFound = 0;
	for (Iterator iter = list.iterator(); (iter.hasNext() && (bundlesFound < 2));) {
		String element = (String) iter.next();
		if (element.indexOf("extender") >= 0 || element.indexOf("osgi-annotation") >= 0) {
			iter.remove();
			bundlesFound++;
		}
	}

	return (String[]) list.toArray(new String[list.size()]);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:20,代码来源:ExtenderTest.java

示例2: getTestFrameworkBundlesNames

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
protected String[] getTestFrameworkBundlesNames() {
	String[] bundles = super.getTestFrameworkBundlesNames();

	// remove slf4j
	Collection bnds = new ArrayList(bundles.length);
	CollectionUtils.mergeArrayIntoCollection(bundles, bnds);

	for (Iterator iterator = bnds.iterator(); iterator.hasNext();) {
		String object = (String) iterator.next();
		// remove slf4j
		if (object.startsWith("org.slf4j"))
			iterator.remove();
	}
	// add commons logging
	bnds.add("org.eclipse.bundles,commons-logging,20070611");

	return (String[]) bnds.toArray(new String[bnds.size()]);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:19,代码来源:CommonsLogging104Test.java

示例3: parseCustomAttributes

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Dedicated parsing method that uses the following stack:
 * 
 * <ol> <li>user given {@link AttributeCallback}s</li> <li>{@link StandardAttributeCallback}</li> <li>
 * {@link PropertyRefAttributeCallback}</li> <li>{@link ConventionCallback}</li> </ol> </pre>
 * 
 * @param element XML element
 * @param builder current bean definition builder
 * @param callbacks array of callbacks (can be null/empty)
 */
public static void parseCustomAttributes(Element element, BeanDefinitionBuilder builder,
		AttributeCallback[] callbacks) {
	List list = new ArrayList(8);

	if (!ObjectUtils.isEmpty(callbacks))
		CollectionUtils.mergeArrayIntoCollection(callbacks, list);
	// add standard callback
	list.add(STANDARD_ATTRS_CALLBACK);
	list.add(BLUEPRINT_ATTRS_CALLBACK);
	list.add(PROPERTY_REF_ATTRS_CALLBACK);
	list.add(PROPERTY_CONV_ATTRS_CALLBACK);

	AttributeCallback[] cbacks = (AttributeCallback[]) list.toArray(new AttributeCallback[list.size()]);
	parseAttributes(element, builder, cbacks);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:26,代码来源:ParserUtils.java

示例4: getVisibleClasses

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
private static Class<?>[] getVisibleClasses(Class<?>[] classes, ClassLoaderBridge loader) {
	if (ObjectUtils.isEmpty(classes))
		return classes;

	Set<Class<?>> classSet = new LinkedHashSet<Class<?>>(classes.length);
	CollectionUtils.mergeArrayIntoCollection(classes, classSet);

	// filter class collection based on visibility
	for (Iterator<Class<?>> iter = classSet.iterator(); iter.hasNext();) {
		Class<?> clzz = iter.next();
		if (!loader.canSee(clzz.getName())) {
			iter.remove();
		}
	}
	return (Class[]) classSet.toArray(new Class[classSet.size()]);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:17,代码来源:ClassUtils.java

示例5: getClassHierarchy

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Returns an array of parent classes for the given class. The mode paramater indicates whether only interfaces
 * should be included, classes or both.
 * 
 * This method is normally used for publishing services and determing the
 * {@link org.osgi.framework.Constants#OBJECTCLASS} property.
 * 
 * <p/> Note: this method does class expansion returning parent as well as children classes.
 * 
 * </p>
 * 
 * @see #INCLUDE_ALL_CLASSES
 * @see #INCLUDE_CLASS_HIERARCHY
 * @see #INCLUDE_INTERFACES
 * 
 * @param clazz
 * @param mode
 * 
 * @return array of classes extended or implemented by the given class
 */
public static Class<?>[] getClassHierarchy(Class<?> clazz, ClassSet inclusion) {
	Class<?>[] classes = null;

	if (clazz != null) {

		Set<Class<?>> composingClasses = new LinkedHashSet<Class<?>>();
		boolean includeClasses =
				(inclusion.equals(ClassSet.CLASS_HIERARCHY) || inclusion.equals(ClassSet.ALL_CLASSES));
		boolean includeInterfaces =
				(inclusion.equals(ClassSet.INTERFACES) || inclusion.equals(ClassSet.ALL_CLASSES));

		Class<?> clz = clazz;
		do {
			if (includeClasses) {
				composingClasses.add(clz);
			}

			if (includeInterfaces) {
				CollectionUtils.mergeArrayIntoCollection(getAllInterfaces(clz), composingClasses);
			}

			clz = clz.getSuperclass();
		} while (clz != null && clz != Object.class);

		classes = (Class[]) composingClasses.toArray(new Class[composingClasses.size()]);
	}
	return (classes == null ? new Class[0] : classes);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:49,代码来源:ClassUtils.java

示例6: getAllInterfaces

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Gets all the interfaces recursively.
 * 
 * @param clazz
 * @param interfaces
 * @return
 */
private static Class<?>[] getAllInterfaces(Class<?> clazz, Set<Class<?>> interfaces) {
	Class<?>[] intfs = clazz.getInterfaces();
	CollectionUtils.mergeArrayIntoCollection(intfs, interfaces);

	for (int i = 0; i < intfs.length; i++) {
		getAllInterfaces(intfs[i], interfaces);
	}

	return (Class[]) interfaces.toArray(new Class[interfaces.size()]);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:18,代码来源:ClassUtils.java

示例7: SimpleComponentMetadata

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
public SimpleComponentMetadata(String name, BeanDefinition definition) {
	if (!(definition instanceof AbstractBeanDefinition)) {
		throw new IllegalArgumentException("Unknown bean definition passed in" + definition);
	}
	this.name = name;
	this.beanDefinition = (AbstractBeanDefinition) definition;

	String[] dpdOn = beanDefinition.getDependsOn();

	if (ObjectUtils.isEmpty(dpdOn)) {
		dependsOn = Collections.<String> emptyList();
	} else {
		List<String> dependencies = new ArrayList<String>(dpdOn.length);
		CollectionUtils.mergeArrayIntoCollection(dpdOn, dependencies);
		Collection<String> syntheticDependsOn =
				(Collection<String>) beanDefinition.getAttribute(CycleOrderingProcessor.SYNTHETIC_DEPENDS_ON);

		if (syntheticDependsOn != null) {
			dependencies.removeAll(syntheticDependsOn);
		}

		dependsOn = Collections.unmodifiableList(dependencies);
	}

	if (!StringUtils.hasText(name)) {
		// nested components are always lazy
		activation = ACTIVATION_LAZY;
	} else {
		activation =
				beanDefinition.isSingleton() ? (beanDefinition.isLazyInit() ? ACTIVATION_LAZY : ACTIVATION_EAGER)
						: ACTIVATION_LAZY;
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:34,代码来源:SimpleComponentMetadata.java

示例8: getComponentIds

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
public Set<String> getComponentIds() {
	String[] names = getBeanFactory().getBeanDefinitionNames();
	Set<String> components = new LinkedHashSet<String>(names.length);
	CollectionUtils.mergeArrayIntoCollection(names, components);
	Set<String> filtered = MetadataFactory.filterIds(components);
	return Collections.unmodifiableSet(filtered);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:8,代码来源:SpringBlueprintContainer.java

示例9: addValueArray

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
public void addValueArray(Object values) {
    CollectionUtils.mergeArrayIntoCollection(values, this.values);
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:4,代码来源:HeaderValueHolder.java

示例10: registerService

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
/**
 * Publishes the given object as an OSGi service. It simply assembles the classes required for publishing and then
 * delegates the actual registration to a dedicated method.
 */
@Override
void registerService() {

	synchronized (lock) {
		if (serviceRegistered || !registerService)
			return;
		else
			serviceRegistered = true;
	}

	// if we have a nested bean / non-Spring managed object
	String beanName = (!hasNamedBean ? null : targetBeanName);

	Dictionary serviceProperties = mergeServiceProperties(this.serviceProperties, beanName);

	Class<?>[] intfs = interfaces;

	// filter classes based on visibility
	ClassLoader beanClassLoader = ClassUtils.getClassLoader(targetClass);
	Class<?>[] autoDetectedClasses =
			ClassUtils.getVisibleClasses(interfaceDetector.detect(targetClass), beanClassLoader);

	if (log.isTraceEnabled())
		log.trace("Autoexport mode [" + interfaceDetector + "] discovered on class [" + targetClass + "] classes "
				+ ObjectUtils.nullSafeToString(autoDetectedClasses));

	// filter duplicates
	Set<Class<?>> classes = new LinkedHashSet<Class<?>>(intfs.length + autoDetectedClasses.length);

	CollectionUtils.mergeArrayIntoCollection(intfs, classes);
	CollectionUtils.mergeArrayIntoCollection(autoDetectedClasses, classes);

	Class<?>[] mergedClasses = (Class[]) classes.toArray(new Class[classes.size()]);

	ServiceRegistration reg = registerService(mergedClasses, serviceProperties);
	serviceRegistration = new ServiceRegistrationDecorator(reg);
	safeServiceRegistration.swap(serviceRegistration);

	resolver.setDecorator(serviceRegistration);
	resolver.notifyIfPossible();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:46,代码来源:OsgiServiceFactoryBean.java

示例11: addExtraIntfs

import org.springframework.util.CollectionUtils; //导入方法依赖的package包/类
private String[] addExtraIntfs(String[] extraIntfs) {
	List list = new ArrayList();
	CollectionUtils.mergeArrayIntoCollection(extraIntfs, list);
	CollectionUtils.mergeArrayIntoCollection(classesAsStrings, list);
	return (String[]) list.toArray(new String[list.size()]);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:7,代码来源:GreedyProxyTest.java


注:本文中的org.springframework.util.CollectionUtils.mergeArrayIntoCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。