當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。