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


Java StringUtils.delimitedListToStringArray方法代码示例

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


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

示例1: getFieldType

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public static Class<?> getFieldType(Class<?> persistentClass, String name) throws NoSuchFieldException {
	String[] fields = StringUtils.delimitedListToStringArray(name, ".");
	Class<?> t;

	t = persistentClass.getDeclaredField(fields[0]).getType();

	if (Collection.class.isAssignableFrom(t)) {
		Field collectionField = persistentClass.getDeclaredField(fields[0]);
		ParameterizedType collectionType = (ParameterizedType) collectionField.getGenericType();
		t = (Class<?>) collectionType.getActualTypeArguments()[0];
	}
	if (fields.length == 1) {
		return t;
	} else {
		return getFieldType((Class<?>) t, name.substring(name.indexOf(".") + 1));
	}
}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:18,代码来源:ConversionUtility.java

示例2: getDirectiveValue

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Return the directive value as a String. If the directive does not exist
 * or is invalid (wrong format) a null string will be returned.
 * 
 * @param header
 * @param directive
 * @return
 */
public static String getDirectiveValue(String header, String directive) {
	Assert.notNull(header, "not-null header required");
	Assert.notNull(directive, "not-null directive required");
	String[] directives = StringUtils.tokenizeToStringArray(header, DIRECTIVE_SEPARATOR);

	for (int i = 0; i < directives.length; i++) {
		String[] splittedDirective = StringUtils.delimitedListToStringArray(directives[i].trim(), EQUALS);
		if (splittedDirective.length == 2 && splittedDirective[0].equals(directive))
			return splittedDirective[1];
	}

	return null;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:22,代码来源:ConfigUtils.java

示例3: getFieldType

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public static Class<?> getFieldType(Class<?> persistentClass, String name) throws NoSuchFieldException {
   String[] fields = StringUtils.delimitedListToStringArray(name, ".");
   Class<?> t;

   t = persistentClass.getDeclaredField(fields[0]).getType();

   if (Collection.class.isAssignableFrom(t)) {
      Field collectionField = persistentClass.getDeclaredField(fields[0]);
      ParameterizedType collectionType = (ParameterizedType) collectionField.getGenericType();
      t = (Class<?>) collectionType.getActualTypeArguments()[0];
   }
   if (fields.length == 1) {
      return t;
   } else {
      return getFieldType((Class<?>) t, name.substring(name.indexOf(".") + 1));
   }
}
 
开发者ID:alexander-perucci,项目名称:spring-grow,代码行数:18,代码来源:ConversionUtility.java

示例4: createValidPath

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * Create a valid qname-based xpath
 * 
 * Note: 
 * - the localname will be truncated to 100 chars
 * - the localname should already be encoded for ISO 9075 (in case of MT bootstrap, the @ sign will be auto-encoded, see below)
 * 
 * Some examples:
 *      /
 *      sys:people/cm:admin
 *      /app:company_home/app:dictionary
 *      ../../cm:people_x0020_folder
 *      sys:people/cm:admin_x0040_test
 *      
 * @param path String
 * @return String
 */
private String createValidPath(String path)
{
    StringBuffer validPath = new StringBuffer(path.length());
    String[] segments = StringUtils.delimitedListToStringArray(path, "/");
    for (int i = 0; i < segments.length; i++)
    {
        if (segments[i] != null && segments[i].length() > 0)
        {
            int colonIndex = segments[i].indexOf(QName.NAMESPACE_PREFIX);
            if (colonIndex == -1)
            {
                // eg. ".."
                validPath.append(segments[i]);
            }
            else
            {
                String[] qnameComponents = QName.splitPrefixedQName(segments[i]);
                
                String localName = QName.createValidLocalName(qnameComponents[1]);
                
                // MT: bootstrap of "alfrescoUserStore.xml" requires 'sys:people/cm:[email protected]' to be encoded as 'sys:people/cm:admin_x0040_tenant' (for XPath)
                localName = localName.replace("@", "_x0040_");
                
                QName segmentQName = QName.createQName(qnameComponents[0], localName, namespaceService);
                validPath.append(segmentQName.toPrefixString());
            }
        }
        if (i < (segments.length -1))
        {
            validPath.append("/");
        }
    }
    return validPath.toString();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:52,代码来源:ImporterComponent.java

示例5: substituteSystemProps

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
/**
 * We need to insert the system properties as a list of -Dkey=value entries
 * instead of just pasting the String that contains these values
 */
private String[] substituteSystemProps(String... commands) {
	boolean containsSystemProps = this.properties.getMaven().getSystemProperties().contains("-D");
	String[] splitSystemProps = StringUtils.delimitedListToStringArray(this.properties.getMaven()
			.getSystemProperties(), "-D");
	// first element might be empty even though the second one contains values
	if (splitSystemProps.length > 1) {
		splitSystemProps = StringUtils.isEmpty(splitSystemProps[0]) ?
				Arrays.copyOfRange(splitSystemProps, 1, splitSystemProps.length) :
				splitSystemProps;
	}
	String[] systemPropsWithPrefix = containsSystemProps ? Arrays.stream(splitSystemProps)
			.map(s -> "-D" + s.trim())
			.collect(Collectors.toList())
			.toArray(new String[splitSystemProps.length]) : splitSystemProps;
	final AtomicInteger index = new AtomicInteger(-1);
	for (int i = 0; i < commands.length; i++) {
		if (commands[i].contains(ReleaserProperties.Maven.SYSTEM_PROPS_PLACEHOLDER)) {
			index.set(i);
			break;
		}
	}
	List<String> commandsList = new ArrayList<>(Arrays.asList(commands));
	List<String> systemPropsList = Arrays.asList(systemPropsWithPrefix);
	if (index.get() != -1) {
		commandsList.remove(index.get());
		if (index.get() >= commandsList.size()) {
			commandsList.addAll(systemPropsList);
		} else {
			// we need to reverse to set the objects in the same order as passed in the prop
			List<String> reversedSystemProps = new ArrayList<>(systemPropsList);
			Collections.reverse(reversedSystemProps);
			reversedSystemProps.forEach(s -> commandsList.add(index.get(), s));
		}
	}
	return commandsList.toArray(new String[commandsList.size()]);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:41,代码来源:ProjectBuilder.java

示例6: createSearchFieldList

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
private List<SearchField> createSearchFieldList(String aSearchNames, String aSearchValues,
      List<SearchField> addedFilters) {
   String[] values, names;
   List<SearchField> res = new ArrayList<SearchField>();
   values = StringUtils.delimitedListToStringArray(aSearchValues, SEARCH_SEPARATOR);
   names = StringUtils.delimitedListToStringArray(aSearchNames, SEARCH_SEPARATOR);
   int i = 0;
   for (String name : names) {
      String val = values[i];
      if (name.startsWith("json_")) {
         String temp = name.substring(5);
         name = temp.replace("_", ".");
      }
      if (isRangeValue(val)) {
         SearchField sfFrom = new SearchField(name);
         SearchField sfTo = new SearchField(name);
         sfFrom.setValue(getRangeValue(val, 0));
         sfFrom.setRangeType(SearchField.RangeType.RANGE_FROM);
         sfFrom.setNullType(SearchField.NullType.NO_NULL);
         sfTo.setValue(getRangeValue(val, 1));
         sfTo.setRangeType(SearchField.RangeType.RANGE_TO);
         sfTo.setNullType(SearchField.NullType.NO_NULL);
         res.add(sfFrom);
         res.add(sfTo);
      } else {
         SearchField sf = new SearchField(name);
         sf.setRangeType(SearchField.RangeType.RANGE_NONE);
         sf.setValue(val);
         sf.setNullType(SearchField.NullType.NO_NULL);
         sf.setAddPercentPrefix(true);
         res.add(sf);
      }
      i++;
   }
   res.addAll(addedFilters);
   return res;
}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:38,代码来源:DataTablesRequestGrid.java

示例7: addPrefixToProtocollo

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public void addPrefixToProtocollo(String protocoloName) {
   String[] names = StringUtils.delimitedListToStringArray(this.getaSearchNames(),
         DataTablesRequestGrid.SEARCH_SEPARATOR);
   String[] values = StringUtils.delimitedListToStringArray(this.getaSearchValues(),
         DataTablesRequestGrid.SEARCH_SEPARATOR);
   StringBuilder newNames = new StringBuilder();
   StringBuilder newValues = new StringBuilder();
   String protocolloNormValue = null;
   for (int i = 0; i < names.length; i++) {
      String name = names[i];
      if (!protocoloName.equals(name)) {
         newNames.append(name);
         newValues.append(values[i]);
         if (i < (names.length - 1)) {
            newNames.append(DataTablesRequestGrid.SEARCH_SEPARATOR);
            newValues.append(DataTablesRequestGrid.SEARCH_SEPARATOR);
         }
      } else {
         protocolloNormValue = values[i];
      }
   }

   this.setaSearchNames(newNames.toString());
   this.setaSearchValues(newValues.toString());
   SearchField sf = new SearchField(protocoloName);
   sf.setNullType(SearchField.NullType.NO_NULL);
   sf.setValue(protocolloNormValue);
   sf.setRangeType(SearchField.RangeType.RANGE_NONE);
   if (isAddPercentPrefix()) {
      sf.setAddPercentPrefix(true);
   }
   this.addFilter(sf);

}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:35,代码来源:DataTablesRequestGrid.java

示例8: isCollectionFieldType

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public static boolean isCollectionFieldType(Class<?> persistentClass, String name) throws NoSuchFieldException {
	String[] fields = StringUtils.delimitedListToStringArray(name, ".");
	Class<?> t;

	t = persistentClass.getDeclaredField(fields[0]).getType();
	return Collection.class.isAssignableFrom(t);
}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:8,代码来源:ConversionUtility.java

示例9: getRange

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
private int[] getRange(String field, int min, int max) {
	int[] result = new int[2];
	if (field.contains("*")) {
		result[0] = min;
		result[1] = max - 1;
		return result;
	}
	if (!field.contains("-")) {
		result[0] = result[1] = Integer.valueOf(field);
	}
	else {
		String[] split = StringUtils.delimitedListToStringArray(field, "-");
		if (split.length > 2) {
			throw new IllegalArgumentException("Range has more than two fields: '" +
					field + "' in expression \"" + this.expression + "\"");
		}
		result[0] = Integer.valueOf(split[0]);
		result[1] = Integer.valueOf(split[1]);
	}
	if (result[0] >= max || result[1] >= max) {
		throw new IllegalArgumentException("Range exceeds maximum (" + max + "): '" +
				field + "' in expression \"" + this.expression + "\"");
	}
	if (result[0] < min || result[1] < min) {
		throw new IllegalArgumentException("Range less than minimum (" + min + "): '" +
				field + "' in expression \"" + this.expression + "\"");
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:CronSequenceGenerator.java

示例10: setAsText

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
@Override
public void setAsText(String text) throws IllegalArgumentException {
	String[] array = StringUtils.delimitedListToStringArray(text, this.separator, this.charsToDelete);
	if (trimValues) {
		array = StringUtils.trimArrayElements(array);
	}
	if (this.emptyArrayAsNull && array.length == 0) {
		setValue(null);
	}
	else {
		setValue(array);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:StringArrayPropertyEditor.java

示例11: addPrefixToProtocollo

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public void addPrefixToProtocollo(String protocoloName) {
   String[] names = StringUtils.delimitedListToStringArray(this.getaSearchNames(),
         DataTablesRequest.SEARCH_SEPARATOR);
   String[] values = StringUtils.delimitedListToStringArray(this.getaSearchValues(),
         DataTablesRequest.SEARCH_SEPARATOR);
   StringBuilder newNames = new StringBuilder();
   StringBuilder newValues = new StringBuilder();
   String protocolloNormValue = null;
   for (int i = 0; i < names.length; i++) {
      String name = names[i];
      if (!protocoloName.equals(name)) {
         newNames.append(name);
         newValues.append(values[i]);
         if (i < (names.length - 1)) {
            newNames.append(DataTablesRequest.SEARCH_SEPARATOR);
            newValues.append(DataTablesRequest.SEARCH_SEPARATOR);
         }
      } else {
         protocolloNormValue = values[i];
      }
   }

   this.setaSearchNames(newNames.toString());
   this.setaSearchValues(newValues.toString());
   SearchField sf = new SearchField(protocoloName);
   sf.setNullType(SearchField.NullType.NO_NULL);
   sf.setValue(protocolloNormValue);
   sf.setRangeType(SearchField.RangeType.RANGE_NONE);
   if (isAddPercentPrefix()) {
      sf.setAddPercentPrefix(true);
   }
   this.addFilter(sf);

}
 
开发者ID:alexander-perucci,项目名称:spring-grow,代码行数:35,代码来源:DataTablesRequest.java

示例12: isCollectionFieldType

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public static boolean isCollectionFieldType(Class<?> persistentClass, String name) throws NoSuchFieldException {
   String[] fields = StringUtils.delimitedListToStringArray(name, ".");
   Class<?> t;

   t = persistentClass.getDeclaredField(fields[0]).getType();
   return Collection.class.isAssignableFrom(t);
}
 
开发者ID:alexander-perucci,项目名称:spring-grow,代码行数:8,代码来源:ConversionUtility.java

示例13: getAlias

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public String getAlias() {        
    String[] temp = StringUtils.delimitedListToStringArray(name, ".");
    return ALIAS_PREFIX.concat(temp[0]);        
}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:5,代码来源:SearchField.java

示例14: getNameRoot

import org.springframework.util.StringUtils; //导入方法依赖的package包/类
public String getNameRoot() {
    return  StringUtils.delimitedListToStringArray(name, ".")[0];        
}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:4,代码来源:SearchField.java


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