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


Java StringUtils.toStringArray方法代码示例

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


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

示例1: resolveMessageCodes

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Build the code list for the given code and field: an
 * object/field-specific code, a field-specific code, a plain error code.
 * <p>Arrays, Lists and Maps are resolved both for specific elements and
 * the whole collection.
 * <p>See the {@link DefaultMessageCodesResolver class level Javadoc} for
 * details on the generated codes.
 * @return the list of codes
 */
@Override
public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class<?> fieldType) {
	Set<String> codeList = new LinkedHashSet<String>();
	List<String> fieldList = new ArrayList<String>();
	buildFieldList(field, fieldList);
	addCodes(codeList, errorCode, objectName, fieldList);
	int dotIndex = field.lastIndexOf('.');
	if (dotIndex != -1) {
		buildFieldList(field.substring(dotIndex + 1), fieldList);
	}
	addCodes(codeList, errorCode, null, fieldList);
	if (fieldType != null) {
		addCode(codeList, errorCode, null, fieldType.getName());
	}
	addCode(codeList, errorCode, null, null);
	return StringUtils.toStringArray(codeList);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:DefaultMessageCodesResolver.java

示例2: getAttributeNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getAttributeNames(int scope) {
	if (scope == SCOPE_REQUEST) {
		if (!isRequestActive()) {
			throw new IllegalStateException(
					"Cannot ask for request attributes - request is not active anymore!");
		}
		return StringUtils.toStringArray(this.request.getAttributeNames());
	}
	else {
		HttpSession session = getSession(false);
		if (session != null) {
			try {
				return StringUtils.toStringArray(session.getAttributeNames());
			}
			catch (IllegalStateException ex) {
				// Session invalidated - shouldn't usually happen.
			}
		}
		return new String[0];
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:ServletRequestAttributes.java

示例3: getPropertyNameTokens

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Parse the given property name into the corresponding property name tokens.
 * @param propertyName the property name to parse
 * @return representation of the parsed property tokens
 */
private PropertyTokenHolder getPropertyNameTokens(String propertyName) {
	PropertyTokenHolder tokens = new PropertyTokenHolder();
	String actualName = null;
	List<String> keys = new ArrayList<String>(2);
	int searchIndex = 0;
	while (searchIndex != -1) {
		int keyStart = propertyName.indexOf(PROPERTY_KEY_PREFIX, searchIndex);
		searchIndex = -1;
		if (keyStart != -1) {
			int keyEnd = propertyName.indexOf(PROPERTY_KEY_SUFFIX, keyStart + PROPERTY_KEY_PREFIX.length());
			if (keyEnd != -1) {
				if (actualName == null) {
					actualName = propertyName.substring(0, keyStart);
				}
				String key = propertyName.substring(keyStart + PROPERTY_KEY_PREFIX.length(), keyEnd);
				if ((key.startsWith("'") && key.endsWith("'")) || (key.startsWith("\"") && key.endsWith("\""))) {
					key = key.substring(1, key.length() - 1);
				}
				keys.add(key);
				searchIndex = keyEnd + PROPERTY_KEY_SUFFIX.length();
			}
		}
	}
	tokens.actualName = (actualName != null ? actualName : propertyName);
	tokens.canonicalName = tokens.actualName;
	if (!keys.isEmpty()) {
		tokens.canonicalName +=
				PROPERTY_KEY_PREFIX +
				StringUtils.collectionToDelimitedString(keys, PROPERTY_KEY_SUFFIX + PROPERTY_KEY_PREFIX) +
				PROPERTY_KEY_SUFFIX;
		tokens.keys = StringUtils.toStringArray(keys);
	}
	return tokens;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:BeanWrapperImpl.java

示例4: getBeanNamesForType

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean includeFactoryBeans) {
	boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type));
	List<String> matches = new ArrayList<String>();
	for (String name : this.beans.keySet()) {
		Object beanInstance = this.beans.get(name);
		if (beanInstance instanceof FactoryBean && !isFactoryType) {
			if (includeFactoryBeans) {
				Class<?> objectType = ((FactoryBean<?>) beanInstance).getObjectType();
				if (objectType != null && (type == null || type.isAssignableFrom(objectType))) {
					matches.add(name);
				}
			}
		}
		else {
			if (type == null || type.isInstance(beanInstance)) {
				matches.add(name);
			}
		}
	}
	return StringUtils.toStringArray(matches);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:StaticListableBeanFactory.java

示例5: getDependentPropertyNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Return the names of all property that the specified bean depends on, if any.
 *
 * @param beanName the name of the bean
 * @return the array of dependent property names, or an empty array if none
 */
public String[] getDependentPropertyNames(String beanName) {
    beanName = ProxyUtils.getOriginalBeanName(beanName);
    Set<String> dependentPropertyNames = this.dependentPropertyMap.get(beanName);
    if (dependentPropertyNames == null) {
        return new String[0];
    }
    return StringUtils.toStringArray(dependentPropertyNames);
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:15,代码来源:RefreshBeanDependencyFactory.java

示例6: getAttributeNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getAttributeNames(int scope) {
	if (scope == SCOPE_GLOBAL_SESSION && portletApiPresent) {
		return PortletSessionAccessor.getAttributeNames(getExternalContext());
	}
	else {
		return StringUtils.toStringArray(getAttributeMap(scope).keySet());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:FacesRequestAttributes.java

示例7: calculateMatches

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Generate possible property alternatives for the given property and
 * class. Internally uses the {@code getStringDistance} method, which
 * in turn uses the Levenshtein algorithm to determine the distance between
 * two Strings.
 * @param propertyDescriptors the JavaBeans property descriptors to search
 * @param maxDistance the maximum distance to accept
 */
private String[] calculateMatches(PropertyDescriptor[] propertyDescriptors, int maxDistance) {
	List<String> candidates = new ArrayList<String>();
	for (PropertyDescriptor pd : propertyDescriptors) {
		if (pd.getWriteMethod() != null) {
			String possibleAlternative = pd.getName();
			if (calculateStringDistance(this.propertyName, possibleAlternative) <= maxDistance) {
				candidates.add(possibleAlternative);
			}
		}
	}
	Collections.sort(candidates);
	return StringUtils.toStringArray(candidates);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:PropertyMatches.java

示例8: freezeConfiguration

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public void freezeConfiguration() {
	this.configurationFrozen = true;
	synchronized (this.beanDefinitionMap) {
		this.frozenBeanDefinitionNames = StringUtils.toStringArray(this.beanDefinitionNames);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:DefaultListableBeanFactory.java

示例9: getBeanDefinitionNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getBeanDefinitionNames() {
	synchronized (this.beanDefinitionMap) {
		if (this.frozenBeanDefinitionNames != null) {
			return this.frozenBeanDefinitionNames;
		}
		else {
			return StringUtils.toStringArray(this.beanDefinitionNames);
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:DefaultListableBeanFactory.java

示例10: unsatisfiedNonSimpleProperties

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Return an array of non-simple bean properties that are unsatisfied.
 * These are probably unsatisfied references to other beans in the
 * factory. Does not include simple properties like primitives or Strings.
 * @param mbd the merged bean definition the bean was created with
 * @param bw the BeanWrapper the bean was created with
 * @return an array of bean property names
 * @see org.springframework.beans.BeanUtils#isSimpleProperty
 */
protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) {
	Set<String> result = new TreeSet<String>();
	PropertyValues pvs = mbd.getPropertyValues();
	PropertyDescriptor[] pds = bw.getPropertyDescriptors();
	for (PropertyDescriptor pd : pds) {
		if (pd.getWriteMethod() != null && !isExcludedFromDependencyCheck(pd) && !pvs.contains(pd.getName()) &&
				!BeanUtils.isSimpleProperty(pd.getPropertyType())) {
			result.add(pd.getName());
		}
	}
	return StringUtils.toStringArray(result);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AbstractAutowireCapableBeanFactory.java

示例11: destroySingletons

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public void destroySingletons() {
	if (logger.isDebugEnabled()) {
		logger.debug("Destroying singletons in " + this);
	}
	synchronized (this.singletonObjects) {
		this.singletonsCurrentlyInDestruction = true;
	}

	String[] disposableBeanNames;
	synchronized (this.disposableBeans) {
		disposableBeanNames = StringUtils.toStringArray(this.disposableBeans.keySet());
	}
	for (int i = disposableBeanNames.length - 1; i >= 0; i--) {
		destroySingleton(disposableBeanNames[i]);
	}

	this.containedBeanMap.clear();
	this.dependentBeanMap.clear();
	this.dependenciesForBeanMap.clear();

	synchronized (this.singletonObjects) {
		this.singletonObjects.clear();
		this.singletonFactories.clear();
		this.earlySingletonObjects.clear();
		this.registeredSingletons.clear();
		this.singletonsCurrentlyInDestruction = false;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:DefaultSingletonBeanRegistry.java

示例12: getPropertyNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getPropertyNames() {
    return StringUtils.toStringArray(this.source.keys());
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:5,代码来源:ConfigPropertySource.java

示例13: getHeaderValues

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getHeaderValues(String headerName) {
	String[] headerValues = StringUtils.toStringArray(getRequest().getHeaders(headerName));
	return (!ObjectUtils.isEmpty(headerValues) ? headerValues : null);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:ServletWebRequest.java

示例14: getBeanDefinitionNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getBeanDefinitionNames() {
	return StringUtils.toStringArray(this.beans.keySet());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:StaticListableBeanFactory.java

示例15: getRegisteredScopeNames

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public String[] getRegisteredScopeNames() {
	return StringUtils.toStringArray(this.scopes.keySet());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AbstractBeanFactory.java


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