Example usage for org.apache.commons.lang3 StringUtils join

List of usage examples for org.apache.commons.lang3 StringUtils join

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils join.

Prototype

public static String join(final Iterable<?> iterable, final String separator) 

Source Link

Document

Joins the elements of the provided Iterable into a single String containing the provided elements.

No delimiter is added before or after the list.

Usage

From source file:com.threewks.thundr.bind.TestBindTo.java

public Object methodStringList(List<String> argument1) {
    return StringUtils.join(argument1, ":");
}

From source file:com.thoughtworks.go.config.AntTask.java

public String arguments() {
    ArrayList<String> args = new ArrayList<>();
    if (buildFile != null) {
        args.add("-f \"" + FilenameUtils.separatorsToUnix(buildFile) + "\"");
    }//from  w  w w. j  av  a2  s .c  o  m

    if (target != null) {
        args.add(target);
    }

    return StringUtils.join(args, " ");
}

From source file:eu.europa.ec.fisheries.uvms.reporting.service.entities.converter.ListStringConverter.java

@Override
public String convertToDatabaseColumn(List strings) {
    return strings == null ? null : StringUtils.join(strings, ",");
}

From source file:com.thoughtworks.go.spark.SparkController.java

default String controllerPath(Object... paths) {
    if (paths == null || paths.length == 0) {
        return controllerBasePath();
    } else {/*  w w w  . j  a  v a  2 s. c  o m*/
        return (controllerBasePath() + "/" + StringUtils.join(paths, '/')).replaceAll("//", "/");
    }
}

From source file:net.acesinc.druid.servlet.filter.CORSServletFilterHolder.java

@Override
public Map<String, String> getInitParameters() {
    Map<String, String> initParams = new HashMap<>();
    if (!allowedOrigins.isEmpty()) {
        initParams.put("cors.allowed.origins", StringUtils.join(allowedOrigins, ','));
    }//w ww .  j  av  a  2  s .  co  m

    if (initParams.isEmpty()) {
        return null;
    } else {
        return initParams;
    }
}

From source file:net.sourceforge.mavenhippo.gen.DefaultPackageGenerator.java

@Override
public String getPackageName() {
    return StringUtils.join(packageName, '.');
}

From source file:com.vmware.photon.controller.api.frontend.exceptions.external.StepNotFoundException.java

public StepNotFoundException(TaskEntity taskEntity, Operation operation) {
    super(ErrorCode.STEP_NOT_FOUND);
    this.operation = operation;
    this.taskEntity = taskEntity;
    addData("id", taskEntity.getId());
    addData("state", taskEntity.getState().toString());
    addData("steps", StringUtils.join(taskEntity.getSteps(), ';'));
}

From source file:com.nike.vault.client.VaultServerException.java

/**
 * Construction of the exception with the specified code and error message list.
 *
 * @param code   HTTP response code//  w w  w.j av a 2s  .  c o  m
 * @param errors List of error messages
 */
public VaultServerException(final int code, final List<String> errors) {
    super(String.format(MESSAGE_FORMAT, code, StringUtils.join(errors, ", ")));
    this.code = code;
    this.errors = errors;
}

From source file:hr.fer.tel.rovkp.homework03.task01.JokesCollection.java

public static Map<Integer, String> parseInputFile(String file) throws IOException {
    Path filePath = Paths.get(file);
    Map<Integer, String> results = new HashMap<>();

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

    try (Stream<String> stream = Files.lines(filePath)) {
        stream.forEach(line -> {/* w w w  .  j  av a2 s . c o m*/
            if (line == null)
                return;
            line = line.trim();

            if (line.isEmpty() && !currentJoke.isEmpty()) {
                int currentId = ids.getLast();
                String jokeText = StringUtils.join(currentJoke, "\n");
                jokeText = StringEscapeUtils.unescapeXml(jokeText.toLowerCase().replaceAll("\\<.*?\\>", ""));
                if (results.putIfAbsent(currentId, jokeText) != null)
                    System.err.println("Joke with id " + currentId + "already exists. Not overwriting.");
            } else if (line.matches("^[0-9]+:$")) {
                ids.addLast(Integer.parseInt(line.substring(0, line.length() - 1)));
                currentJoke.clear();
            } else {
                currentJoke.add(line);
            }
        });
    }

    return results;
}

From source file:com.neocotic.bloggaer.account.MissingCapabilityException.java

/**
 * Creates a suitable error message for the {@code capabilities} provided.
 * /*from w w  w  . j  a  v  a  2 s.  c om*/
 * @param capabilities
 *            the {@link Collection} missing {@link Capability Capabilities}, may be {@code null}
 * @return The error message.
 */
private static String createMessage(Collection<Capability> capabilities) {
    StringBuilder buffer = new StringBuilder("Account is missing required capabilities");
    if (capabilities != null) {
        buffer.append(": ");
        buffer.append(StringUtils.join(capabilities, ", "));
    }
    return buffer.toString();
}