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


Java StringUtils.join方法代码示例

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


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

示例1: parseArgs

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * Parses the given command-line arguments and locally saves the job name and parameters.
 * <p/>
 * Throws if any basic syntax errors.
 */
public void parseArgs(String[] args)
{
  jobName = null;
  parameters = null;
  commandLine = null;
  if (args != null && args.length > 0)
  {
    commandLine = StringUtils.join(args, " ");
    jobName = parseJobName(args[0]);
    parameters = parseParameters(args);
  }
  else
  {
    throw new CmdlineException("Syntax Error: Please specify some arguments");
  }
}
 
开发者ID:Nike-Inc,项目名称:bluegreen-manager,代码行数:22,代码来源:ArgumentParser.java

示例2: convertQueryComponentToQueryFragment

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
protected String convertQueryComponentToQueryFragment(QueryComponent queryComponent) {
    if (!queryComponent.isFieldedQuery()) {
        return queryComponent.getQuery();
    }

    String field = this.getEncodedFieldName(queryComponent.getField());
    if (field == null) {
        throw new SearchException("Unable to build query string - there is no field named '%s' on %s", queryComponent.getField(), type.getSimpleName());
    }
    String operation = IsSymbols.get(queryComponent.getIs());
    if (queryComponent.isCollectionQuery()) {
        List<String> values = convertValuesToString(field, queryComponent.getCollectionValue());
        String stringValue = StringUtils.join(values, " OR ");
        return String.format("%s:(%s)", field, stringValue);
    } else {
        String value = convertValueToString(field, queryComponent.getValue());
        return String.format("%s%s%s", field, operation, value);
    }
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:20,代码来源:BaseGaeSearchService.java

示例3: invokeMethod

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 * 执行某对象方法
 * 
 * @param owner
 *            对象
 * @param methodName
 *            方法名
 * @param args
 *            参数
 * @return 方法返回值
 */
public static final Object invokeMethod(Object owner, String methodName, Object... args) {
    Class<?> ownerClass = owner.getClass();
    String key = null;
    if (args != null) {
        Class<?>[] argsClass = new Class[args.length];
        for (int i = 0, j = args.length; i < j; i++) {
            if (args[i] != null) {
                argsClass[i] = args[i].getClass();
            }
        }
        key = ownerClass + "_" + methodName + "_" + StringUtils.join(argsClass, ","); // 用于区分重载的方法
    } else {
        key = ownerClass + "_" + methodName; // 用于区分重载的方法
    }
    MethodAccess methodAccess = methodMap.get(key);
    if (methodAccess == null) {
        methodAccess = MethodAccess.get(ownerClass);
        methodMap.put(key, methodAccess); // 缓存Method对象
    }
    return methodAccess.invoke(owner, methodName, args);
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:33,代码来源:InstanceUtil.java

示例4: renderParams

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private static String renderParams(JoinPoint joinPoint, String[] params, String[] includeParamNames,
                                   String[] excludeParamNames, boolean inputCollectionAware) {

    Set<String> includeSet = prepareNameSet(includeParamNames);
    Set<String> excludeSet = prepareNameSet(excludeParamNames);
    List<String> requestList = new ArrayList<>();

    Map<String, Object> paramMap = joinPointToParamMap(joinPoint, params);

    if (!includeSet.isEmpty()) {
        includeSet
            .stream().filter(paramMap::containsKey)
            .forEach(key -> requestList.add(buildParam(key, paramMap.get(key), inputCollectionAware)));
    } else if (!excludeSet.isEmpty()) {
        paramMap.forEach((key, value) -> {
            if (!excludeSet.contains(key)) {
                requestList.add(buildParam(key, value, inputCollectionAware));
            }
        });
    } else {
        paramMap.forEach((key, value) -> requestList.add(buildParam(key, value, inputCollectionAware)));
    }

    return StringUtils.join(requestList, ',');
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:26,代码来源:LogObjectPrinter.java

示例5: buildQueryString

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
protected String buildQueryString(List<QueryComponent> queryComponents) {
    List<String> stringQueryComponents = new ArrayList<>();
    for (QueryComponent queryComponent : queryComponents) {
        String fragmentString = convertQueryComponentToQueryFragment(queryComponent);
        stringQueryComponents.add(fragmentString);
    }
    return StringUtils.join(stringQueryComponents, " ");
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:9,代码来源:BaseGaeSearchService.java

示例6: initialize

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public void initialize(File workingDirectory, String[] arguments) {

		if (arguments.length != 2) {
			// Change to String.join upon migrating to Java 1.8.
			throw new RuntimeException("Please specify a mdf-filename and a wind field type as arguments. Supported types are: " + StringUtils.join(supportedFieldTypes, ", "));
		}

		String mdfFileName = arguments[0];

		fieldType = arguments[1];
		if (!(supportedFieldTypes.contains(fieldType))) {
			// Change to String.join upon migrating to Java 1.8.
			throw new RuntimeException("Unrecognised wind field type specified as argument, choose from: " + StringUtils.join(supportedFieldTypes, ", "));
		}

		modelDefinitionFile = ModelDefinitionFile.getModelDefinitionFile(workingDirectory, mdfFileName);

		File windFile = modelDefinitionFile.getFieldFile(fieldType, true);

		try {
			FileReader fileReader = new FileReader(windFile);
			BufferedReader inputFileBufferedReader = new BufferedReader(fileReader);

			if (fieldType.equals(ModelDefinitionFile.WINDGU)) {
				windExchangeItem = readExchangeItem2D(inputFileBufferedReader, "windgu");
			} else if (fieldType.equals(ModelDefinitionFile.WINDGV)) {
				windExchangeItem = readExchangeItem2D(inputFileBufferedReader, "windgv");
			}else if (fieldType.equals(ModelDefinitionFile.WINDWU)) {
				windExchangeItem = readExchangeItem2D(inputFileBufferedReader, "windu");
			}else if (fieldType.equals(ModelDefinitionFile.WINDWV)) {
				windExchangeItem = readExchangeItem2D(inputFileBufferedReader, "windv");
			}
			inputFileBufferedReader.close();
			fileReader.close();

		} catch (IOException e) {
			throw new RuntimeException("Could not read from " + windFile.getAbsolutePath() + "\n" + e.getMessage());
		}
	}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:40,代码来源:D3dWindFile.java

示例7: getCensoringEventsQuery

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String getCensoringEventsQuery(Criteria[] censoringCriteria)
{
  ArrayList<String> criteriaQueries = new ArrayList<>();
  for (Criteria c : censoringCriteria)    
  {
    String criteriaQuery = c.accept(this);
    criteriaQueries.add(StringUtils.replace(CENSORING_QUERY_TEMPLATE, "@criteriaQuery", criteriaQuery));
  }
  
  return StringUtils.join(criteriaQueries,"\nUNION ALL\n");
}
 
开发者ID:OHDSI,项目名称:circe-be,代码行数:12,代码来源:CohortExpressionQueryBuilder.java

示例8: startElement

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    this.nodeStack.push(localName);
    String nodePath = StringUtils.join(this.nodeStack, '/');
    //Debug.d("Parser start: "+nodePath);

    if (nodePath.equals("/locale")) {
        this.parseLocale(attributes);
    } else if (nodePath.equals("/locale/map")) {
        this.parseMap(attributes);
    } else if (nodePath.equals("/locale/shell")) {
        this.parseShell(attributes);
    } else if (nodePath.equals("/locale/music")) {
        this.parseMusic(attributes);
    } else if (nodePath.equals("/locale/inventory")) {
        this.parseInventory(attributes);
    } else if (nodePath.equals("/locale/market")) {
        this.parseMarket(attributes);
    } else if (nodePath.equals("/locale/workshop")) {
        this.parseWorkshop(attributes);
    } else if (nodePath.equals("/locale/people/person")) {
        this.parsePerson(attributes);
    } else if (nodePath.equals("/locale/games/game")) {
        this.parseGame(attributes);
    } else if (nodePath.equals("/locale/decorations/decoration")) {
        this.parseDecoration(attributes);
    } else if (nodePath.equals("/locale/tour")) {
        this.parseTourGuide(attributes);
    } else if (nodePath.equals("/locale/tour/stop")) {
        this.parseTourStop(attributes);
    } else if (nodePath.equals("/locale/tour/stop/message")) {
        this.parseTourStopMessage(attributes);
    } else if (nodePath.equals("/locale/numbers/number")) {
        this.parseNumberDefinition(attributes);
    } else if (nodePath.equals("/locale/letters/letter")) {
        this.parseLetterDefinition(attributes);
    } else if (nodePath.equals("/locale/words/word")) {
        this.parseWordDefinition(attributes);
    } else if (nodePath.equals("/locale/levels/level")) {
        this.parseLevel(attributes);
    } else if (nodePath.equals("/locale/levels/level/intro/page")) {
        this.parseLevelIntroPage(attributes);
    } else if (nodePath.equals("/locale/levels/level/req/gather_letter")) {
        this.currentReqLetter = new CollectLetterReq();
        this.parseLevelReqLetter(attributes);
    } else if (nodePath.equals("/locale/levels/level/req/gather_word")) {
        this.currentReqWord = new CollectWordReq();
        this.parseLevelReqWord(attributes);
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:51,代码来源:LocaleParser.java

示例9: ResourceId

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private ResourceId(final String id) {
    if (id == null) {
        // Protect against NPEs from null IDs, preserving legacy behavior for null IDs
        return;
    } else {
        // Skip the first '/' if any, and then split using '/'
        String[] splits = (id.startsWith("/")) ? id.substring(1).split("/") : id.split("/");
        if (splits.length % 2 == 1) {
            throw new InvalidParameterException(badIdErrorText(id));
        }

        // Save the ID itself
        this.id = id;

        // Format of id:
        // /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/<providerNamespace>(/<parentResourceType>/<parentName>)*/<resourceType>/<name>
        //  0             1                2              3                   4         5                                                        N-2            N-1

        // Extract resource type and name
        if (splits.length < 2) {
            throw new InvalidParameterException(badIdErrorText(id));
        } else {
            this.name = splits[splits.length - 1];
            this.resourceType = splits[splits.length - 2];
        }

        // Extract parent ID
        if (splits.length < 10) {
            this.parentId = null;
        } else {
            String[] parentSplits = new String[splits.length - 2];
            System.arraycopy(splits, 0, parentSplits, 0, splits.length - 2);
            this.parentId = "/" + StringUtils.join(parentSplits, "/");
        }

        for (int i = 0; i < splits.length && i < 6; i++) {
            switch (i) {
            case 0:
                // Ensure "subscriptions"
                if (!splits[i].equalsIgnoreCase("subscriptions")) {
                    throw new InvalidParameterException(badIdErrorText(id));
                }
                break;
            case 1:
                // Extract subscription ID
                this.subscriptionId = splits[i];
                break;
            case 2:
                // Ensure "resourceGroups"
                if (!splits[i].equalsIgnoreCase("resourceGroups")) {
                    throw new InvalidParameterException(badIdErrorText(id));
                }
                break;
            case 3:
                // Extract resource group name
                this.resourceGroupName = splits[i];
                break;
            case 4:
                // Ensure "providers"
                if (!splits[i].equalsIgnoreCase("providers")) {
                    throw new InvalidParameterException(badIdErrorText(id));
                }
                break;
            case 5:
                // Extract provider namespace
                this.providerNamespace = splits[i];
                break;
            default:
                break;
            }
        }
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:74,代码来源:ResourceId.java

示例10: getJsonKeys

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public String getJsonKeys()
{
    return StringUtils.join((Iterable)this.jsonKeys, "->");
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:JsonException.java

示例11: TabularSequenceSummary

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
 *
 */
public TabularSequenceSummary (List<AlignedSequence> overallResults) {

	for (AlignedSequence alignedSeq : overallResults) {
		List<String> sequenceRecord = new ArrayList<>();

		List<Gene> geneList = alignedSeq.getAvailableGenes();
		MutationSet seqMutations = alignedSeq.getMutations();
		String seqName = alignedSeq.getInputSequence().getHeader();

		tabularResults.put(seqName, new HashMap<String, String>());
		String genes = StringUtils.join(geneList, ",");

		// sequenceName
		sequenceRecord.add(seqName);

		// Genes
		sequenceRecord.add(genes);

		// PRStart, PREnd, RTStart, RTEnd, INStart, INEnd
		sequenceRecord.addAll(determineGeneBoundaries(alignedSeq));

		// Subtype(%)
		sequenceRecord.add(determineSubtype(alignedSeq));

		// PcntMix
		sequenceRecord.add(
			NumberFormats.prettyDecimalAsString(alignedSeq.getMixturePcnt()));

		// PRMajor, PRAccessory, PROther,
		// NRTI, NNRTI, RTOther,
		// INMajor, INAccessory, INOther
		sequenceRecord.addAll(determineMutLists(alignedSeq));

	  	// PRSDRMs, RTSDRMs
		sequenceRecord.addAll(determineSdrms(alignedSeq));

	  	// PI-TSMs, NRTI-TSMs, NNRTI-TSMs, INSTI-TSMs
		sequenceRecord.addAll(determineNonDrmTsms(alignedSeq));

	  	// NumFS, FrameShifts
		sequenceRecord.addAll(determineFrameShiftText(alignedSeq));
		// NumIns, Insertions
		sequenceRecord.addAll(determineSeqInsertions(seqMutations));
		// NumDel, Deletions
		sequenceRecord.addAll(determineSeqDeletions(seqMutations));
		// NumStops, StopCodons
		sequenceRecord.addAll(determineSeqStopCodons(seqMutations));
		// NumBDHVN, BDHVN
		sequenceRecord.addAll(determineSeqBDHVN(seqMutations));
		// NumApobec, ApobecMuts
		sequenceRecord.addAll(determineApobecFields(seqMutations));
		// NumUnusual, UnusualMuts
		sequenceRecord.addAll(determineSeqUnusualMuts(seqMutations));
		sequenceRows.add(sequenceRecord);

		for (int i=0; i<headerFields.length; i++) {
			String field = headerFields[i];
			String dataItem = sequenceRecord.get(i);
			tabularResults.get(seqName).put(field, dataItem);
		}
	}
}
 
开发者ID:hivdb,项目名称:sierra,代码行数:66,代码来源:TabularSequenceSummary.java

示例12: toString

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public String toString() {
    return StringUtils.join(steps, ' ');
}
 
开发者ID:aartiPl,项目名称:SDI,代码行数:4,代码来源:Stepper.java

示例13: createInstanceForFusion

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Movie createInstanceForFusion(RecordGroup<Movie, Attribute> cluster) {

	List<String> ids = new LinkedList<>();

	for (Movie m : cluster.getRecords()) {
		ids.add(m.getIdentifier());
	}

	Collections.sort(ids);

	String mergedId = StringUtils.join(ids, '+');

	return new Movie(mergedId, "fused");
}
 
开发者ID:olehmberg,项目名称:winter,代码行数:16,代码来源:MovieXMLReader.java

示例14: cleanDeleteData

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public void cleanDeleteData() {
    int keepdays = YiDuConstants.yiduConf.getInt(YiDuConfig.KEEP_DELETE_DATA_DAYS, 5);

    // 清理txt文件和img文件
    // 按小说删除txt文件和封面文件
    String getDeleteArtcleSql = "select articleno from t_article where deleteflag and modifytime < (now() -  INTERVAL ''{0} days'')";
    List<Integer> articlenoList = yiduJdbcTemplate.queryForList(
            MessageFormat.format(getDeleteArtcleSql, new Object[] { keepdays }), Integer.class);
    for (Integer articleno : articlenoList) {
        Utils.deleteDirectory(Utils.getTextDirectoryPathByArticleno(articleno));
        Utils.deleteDirectory(Utils.getArticlePicPath(articleno));
    }

    // 按章节删除txt文件
    String getDeleteChapterSql = "select * from t_chapter where deleteflag and modifytime < (now() -  INTERVAL ''{0} days'') ";
    if (Utils.isDefined(articlenoList)) {
        getDeleteChapterSql = getDeleteChapterSql + " and articlno not in (" + StringUtils.join(articlenoList, ",")
                + ")";
    }

    List<TChapter> chapterList = yiduJdbcTemplate.query(
            MessageFormat.format(getDeleteChapterSql, new Object[] { keepdays }),
            new BeanPropertyRowMapper<TChapter>(TChapter.class));
    for (TChapter chapter : chapterList) {
        Utils.deleteFile(Utils.getTextFilePathByChapterno(chapter.getArticleno(), chapter.getChapterno()));
    }
    // 清理数据库数据
    Set<String> tableSet = new HashSet<String>();
    tableSet.add("t_user");
    tableSet.add("t_review");
    tableSet.add("t_chapter");
    tableSet.add("t_system_block");
    tableSet.add("t_bookcase");
    tableSet.add("t_article");
    tableSet.add("t_message");
    tableSet.add("t_credit_history");
    String deleteSql = "delete from {0} where deleteflag and modifytime < (now() -  INTERVAL ''{1} days'')";
    for (String table : tableSet) {
        yiduJdbcTemplate.execute(MessageFormat.format(deleteSql, new Object[] { table, keepdays }));
    }
}
 
开发者ID:Chihpin,项目名称:Yidu,代码行数:43,代码来源:CleanDeleteDataServiceImpl.java

示例15: toString

import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String toString() {
    return (queryComponents.isEmpty() ? "*" : StringUtils.join(queryComponents, " ")) + (sortOrder.isEmpty() ? "" : " " + sortOrder);
}
 
开发者ID:lorderikir,项目名称:googlecloud-techtalk,代码行数:5,代码来源:SearchImpl.java


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