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