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