List of usage examples for java.util StringJoiner toString
@Override
public String toString()
From source file:info.archinnov.achilles.internals.strategy.naming.InternalNamingStrategy.java
default String toSnakeCase(String name) { final String[] tokens = splitByCharacterTypeCamelCase(name); final StringJoiner joiner = new StringJoiner("_"); asList(tokens).stream().filter(x -> x != null).map(x -> x.toLowerCase()).forEach(joiner::add); return joiner.toString().replaceAll("_+", "_"); }
From source file:org.openrepose.powerfilter.intrafilterlogging.ResponseLog.java
private Map<String, String> convertResponseHeadersToMap(HttpServletResponseWrapper wrappedServletResponse) { HashMap<String, String> headerMap = new LinkedHashMap<>(); Collection<String> headerNames = wrappedServletResponse.getHeaderNames(); for (String headerName : headerNames) { StringJoiner stringJoiner = new StringJoiner(","); wrappedServletResponse.getHeaders(headerName).forEach(stringJoiner::add); headerMap.put(headerName, stringJoiner.toString()); }//w w w .java2s.c o m return headerMap; }
From source file:com.github.danzx.zekke.ws.rest.patch.jsonpatch.JsonObjectPatchTest.java
private String jsonPatchStr(StringBuilder... operations) { StringJoiner joiner = new StringJoiner(",", "[", "]"); for (StringBuilder opt : operations) joiner.add(opt);//from ww w . j a v a2 s. c o m return joiner.toString(); }
From source file:org.openrepose.powerfilter.intrafilterlogging.RequestLog.java
private Map<String, String> convertRequestHeadersToMap(HttpServletRequest httpServletRequest) { Map<String, String> headerMap = new LinkedHashMap<>(); List<String> headerNames = Collections.list(httpServletRequest.getHeaderNames()); for (String headerName : headerNames) { StringJoiner stringJoiner = new StringJoiner(","); Collections.list(httpServletRequest.getHeaders(headerName)).forEach(stringJoiner::add); headerMap.put(headerName, stringJoiner.toString()); }//from w w w . ja va 2s . c om return headerMap; }
From source file:com.cotrino.knowledgemap.db.Question.java
public String getExpectedAnswer() { StringJoiner sj = new StringJoiner(", "); for (String answer : answers) { sj.add("'" + answer + "'"); }/*from w w w . java2 s . c o m*/ return sj.toString(); }
From source file:com.nike.cerberus.command.validator.UploadCertFilesPathValidator.java
@Override public void validate(final String name, final Path value) throws ParameterException { if (value == null) { throw new ParameterException("Value must be specified."); }//from w w w . j a va 2s . c o m final File certDirectory = value.toFile(); final Set<String> filenames = Sets.newHashSet(); if (!certDirectory.canRead()) { throw new ParameterException("Specified path is not readable."); } if (!certDirectory.isDirectory()) { throw new ParameterException("Specified path is not a directory."); } final FilenameFilter filter = new RegexFileFilter("^.*\\.pem$"); final File[] files = certDirectory.listFiles(filter); Arrays.stream(files).forEach(file -> filenames.add(file.getName())); if (!filenames.containsAll(EXPECTED_FILE_NAMES)) { final StringJoiner sj = new StringJoiner(", ", "[", "]"); EXPECTED_FILE_NAMES.stream().forEach(sj::add); throw new ParameterException("Not all expected files are present! Expected: " + sj.toString()); } }
From source file:org.rippleosi.search.patient.stats.search.PatientStatsQueryStrategy.java
@Override public Object getRequestBody() { OpenEHRPatientStatsRequestBody body = new OpenEHRPatientStatsRequestBody(); // create a CSV list of NHS Numbers for OpenEHR to query associated data StringJoiner csvBuilder = new StringJoiner(","); for (PatientSummary patient : patientSummaries) { csvBuilder.add(patient.getNhsNumber()); }// w w w .j a v a 2 s. c o m body.setExternalIds(csvBuilder.toString()); body.setExternalNamespace(externalNamespace); return body; }
From source file:net.straylightlabs.archivo.net.MindCommand.java
private String buildRequest() { failOnInvalidCommand();/*from w w w . ja v a 2 s . c o m*/ List<String> headerLines = buildHeaderLines(); bodyData.put("type", commandType.toString()); String body = bodyData.toString(); // The length is the number of characters plus two bytes for each \r\n line ending int headerLength = headerLines.stream().mapToInt(String::length).sum() + (headerLines.size() * MindRPC.LINE_ENDING.length()); headerLines.add(0, String.format("MRPC/2 %d %d", headerLength, body.length())); StringJoiner joiner = new StringJoiner(MindRPC.LINE_ENDING, "", MindRPC.LINE_ENDING); headerLines.stream().forEach(joiner::add); joiner.add(body); return joiner.toString(); }
From source file:cc.altruix.javaprologinterop.PlUtilsLogic.java
protected String composeVarNameTxt(String[] varNames) { final StringJoiner stringJoiner = new StringJoiner(","); Arrays.stream(varNames).forEach(x -> stringJoiner.add(x)); return stringJoiner.toString(); }
From source file:org.wildfly.test.security.common.elytron.SimpleServerSslContext.java
@Override public void create(ModelControllerClient client, CLIWrapper cli) throws Exception { // /subsystem=elytron/server-ssl-context=twoWaySSC:add(key-manager=twoWayKM,protocols=["TLSv1.2"], // trust-manager=twoWayTM,security-domain=test,need-client-auth=true) StringBuilder sb = new StringBuilder("/subsystem=elytron/server-ssl-context=").append(name).append(":add("); if (StringUtils.isNotBlank(keyManager)) { sb.append("key-manager=\"").append(keyManager).append("\", "); }//from w ww. ja v a 2s . c o m if (protocols != null) { StringJoiner joiner = new StringJoiner(", "); for (String s : protocols) { String s1 = "\"" + s + "\""; joiner.add(s1); } sb.append("protocols=[").append(joiner.toString()).append("], "); } if (StringUtils.isNotBlank(trustManager)) { sb.append("trust-manager=\"").append(trustManager).append("\", "); } if (StringUtils.isNotBlank(securityDomain)) { sb.append("security-domain=\"").append(securityDomain).append("\", "); } if (authenticationOptional != null) { sb.append("authentication-optional=").append(authenticationOptional).append(", "); } sb.append("need-client-auth=").append(needClientAuth).append(")"); cli.sendLine(sb.toString()); }