List of usage examples for org.apache.commons.lang3 StringUtils join
public static String join(final Iterable<?> iterable, final String separator)
Joins the elements of the provided Iterable into a single String containing the provided elements.
No delimiter is added before or after the list.
From source file:at.co.federmann.gtd.domain.Progress.java
public static Progress resolveProgress(Integer id) { if (id == null) { return null; }/* w ww. j ava2 s . c om*/ for (Progress progress : Progress.values()) { if (id.equals(progress.getId())) { return progress; } } throw new IllegalArgumentException(StringUtils.join("No matching Progress found for ID ", id)); }
From source file:com.gayakwad.gocd.elasticagent.mesos.executors.MemoryMetadata.java
@Override protected String doValidate(String input) { List<String> errors = new ArrayList<>(Arrays.asList(super.doValidate(input))); try {/*from ww w .j av a 2 s .c o m*/ Size.parse(input); } catch (Exception e) { errors.add(e.getMessage()); } errors.removeAll(Collections.singleton(null)); if (errors.isEmpty()) { return null; } return StringUtils.join(errors, ". "); }
From source file:com.skobka.tram.ui.adapter.RouteListAdapter.java
private String getRouteDirections(Route route) { ArrayList<String> items = new ArrayList<>(); for (Direction direction : route.getDirections()) { items.add(direction.getTitle()); }/*from w w w .j a v a 2 s. c o m*/ return StringUtils.join(items, "\n"); }
From source file:dk.dma.ais.encode.EncodeSendTest.java
@Test public void encodeSrmAbmTest() throws SendException, SixbitException { int destination = 992199007; String message = "START TEST TEST TEST END"; AisMessage12 msg12 = new AisMessage12(); msg12.setDestination(destination);/*from www . j av a2 s.c o m*/ msg12.setMessage(message); SendRequest sendRequest = new SendRequest(msg12, 1, destination); String[] sentences = sendRequest.createSentences(); System.out.println("MSG12 SendRequest sentences:\n" + StringUtils.join(sentences, "\r\n")); Abm abm = new Abm(); abm.setTextData(msg12); abm.setSequence(0); abm.setTotal(1); abm.setNum(1); String encoded = abm.getEncoded(); System.out.println("MSG12 ABM encoded: " + encoded); }
From source file:models.PullRequestEventTest.java
@Test public void getPullRequestCommits() throws Exception { // Given/*from w w w.j a va 2 s. co m*/ PullRequestCommit first = createPullRequestCommit("2013-12-01"); PullRequestCommit second = createPullRequestCommit("2013-12-02"); PullRequestCommit third = createPullRequestCommit("2013-12-03"); String[] ids = { first.id, second.id, third.id }; PullRequestEvent event = new PullRequestEvent(); event.newValue = StringUtils.join(ids, PullRequest.DELIMETER); // When List<PullRequestCommit> commits = event.getPullRequestCommits(); // Then assertThat(commits.get(0).id).isEqualTo(third.id); assertThat(commits.get(1).id).isEqualTo(second.id); assertThat(commits.get(2).id).isEqualTo(first.id); }
From source file:eu.danieldk.nlp.conllx.SimpleSentence.java
@Override public String toString() { return StringUtils.join(tokens, '\n'); }
From source file:dsd.dao.CalculatedDataDAO.java
public static int InsertCalculatedData(List<CalculatedData> listOfData, eCalculatedDataType dataType) { try {/*from w ww. j a va 2 s . c om*/ Connection con = DAOProvider.getDataSource().getConnection(); int counter = 0; try { String tableName = GetTableNameForDataType(dataType); counter += DAOProvider.InsertRowsSecure(tableName, StringUtils.join(fields, ','), con, PrepareMultipleValuesForInsert(listOfData)); } catch (Exception exc) { exc.printStackTrace(); } con.close(); return counter; } catch (Exception exc) { exc.printStackTrace(); } return 0; }
From source file:org.meruvian.yama.social.mervid.connect.MervidAdapter.java
@Override public void setConnectionValues(Mervid api, ConnectionValues values) { User user = api.userOperations().getUser(); values.setProviderUserId(user.getId()); values.setDisplayName(user.getUsername()); values.setProfileUrl(StringUtils.join("http://www.merv.id/admin/users/", user.getUsername())); }
From source file:de.vandermeer.skb.interfaces.transformers.Integer_To_RomanLiteral.java
/** * Takes an integer and returns a Roman number literal using upper case ASCII characters. * @param number input number//from ww w . j a v a 2 s.c o m * @return Roman number literal using upper case ASCII characters */ static String convert(Integer number) { return StringUtils.join(Integer_To_RomanLiteral.create().transform(number), ""); }
From source file:com.liferay.blade.cli.command.ShellCommand.java
@Override public void execute() throws Exception { ShellArgs shellArgs = getArgs();/*from w ww . jav a 2s .c o m*/ String host = (shellArgs.getHost() != null) ? shellArgs.getHost() : "localhost"; int port = (shellArgs.getPort() != 0) ? shellArgs.getPort() : 11311; if (!BladeUtil.canConnect(host, port)) { _addError("sh", "Unable to connect to gogo shell on " + host + ":" + port); return; } String gogoCommand = StringUtils.join(shellArgs.getArgs(), " "); _executeCommand(gogoCommand, host, port); }