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:de.upb.wdqa.wdvd.features.revision.RevisionTag.java

@Override
public FeatureStringValue calculate(Revision revision) {
    return new FeatureStringValue(StringUtils.join(revision.getDownloadedTags(), ","));
}

From source file:com.mirth.connect.server.util.DerbyGroupConcat.java

/**
 * Returns the final aggregate value
 */
@Override
public String terminate() {
    return StringUtils.join(strings, ',');
}

From source file:com.jayway.restassured.module.mockmvc.http.AttributeController.java

@RequestMapping(value = "/attribute", method = GET, produces = APPLICATION_JSON_VALUE)
public @ResponseBody String attribute(HttpServletRequest request) {
    Collection<String> attributes = new ArrayList<String>();
    for (String attributeName : Collections.list(request.getAttributeNames())) {
        attributes.add("\"" + attributeName + "\": \"" + request.getAttribute(attributeName) + "\"");
    }/*from w ww . j  av  a  2 s  . c o m*/

    return "{" + StringUtils.join(attributes, ", ") + "}";
}

From source file:io.wcm.caravan.pipeline.extensions.hal.action.RemoveAllProperties.java

@Override
public String getId() {
    return propertiesToKeep.isEmpty() ? "REMOVE-ALL-PROPERTIES"
            : "REMOVE-ALL-PROPERTIES(" + StringUtils.join(propertiesToKeep, '-') + ")";
}

From source file:com.qcadoo.mes.states.messages.util.MessagesUtil.java

/**
 * Join given arguments using separator specified in {@link MessagesUtil#ARGS_SEPARATOR}.
 * //from   w ww. j  a  v  a  2s  . c o m
 * @param splittedArgs
 *            array of translation arguments
 * @return joined string containing all splitterArgs elements, separated by {@link MessagesUtil#ARGS_SEPARATOR}
 */
public static String joinArgs(final String[] splittedArgs) {
    if (ArrayUtils.isEmpty(splittedArgs)) {
        return null;
    }
    return StringUtils.join(splittedArgs, ARGS_SEPARATOR);
}

From source file:annis.gui.exporter.WekaExporter.java

@Override
public void convertText(String queryAnnisQL, int contextLeft, int contextRight, Set<String> corpora,
        String keysAsString, String argsAsString, WebResource annisResource, Writer out) {
    //this is a full result export

    try {/*  w  w  w.  j  a  v a2 s . c o m*/
        WebResource res = annisResource.path("search").path("matrix")
                .queryParam("corpora", StringUtils.join(corpora, ",")).queryParam("q", queryAnnisQL);

        if (argsAsString.startsWith("metakeys=")) {
            res = res.queryParam("metakeys", argsAsString.substring("metakeys".length() + 1));
        }

        InputStream result = res.get(InputStream.class);

        try {
            int c;
            while ((c = result.read()) > -1) {
                out.write(c);
            }
        } finally {
            result.close();
        }

        out.flush();
    } catch (UniformInterfaceException ex) {
        log.error(null, ex);
    } catch (ClientHandlerException ex) {
        log.error(null, ex);
    } catch (IOException ex) {
        log.error(null, ex);
    }
}

From source file:com.ga2sa.utils.ArrayToStringDeserializer.java

@Override
public String deserialize(JsonParser jsonParser, DeserializationContext context)
        throws IOException, JsonProcessingException {
    List<String> array = new ArrayList<String>();
    JsonNode tree = jsonParser.readValueAsTree();
    if (tree.isArray()) {
        tree.forEach(obj -> array.add(obj.textValue()));
    } else {//from w ww .  j a  v  a2 s .c o  m
        array.add(tree.textValue());
    }

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

From source file:com.techcavern.wavetact.ircCommands.misc.BasicCommands.java

@Override
public void onCommand(String command, User user, PircBotX network, String prefix, Channel channel,
        boolean isPrivate, int userPermLevel, String... args) throws Exception {
    command = command.toLowerCase();/*  w  ww  .  j av a 2s .c  om*/
    switch (command) {
    case "version":
        IRCUtils.sendMessage(user, network, channel, Registry.VERSION, prefix);
        break;
    case "potato":
        IRCUtils.sendAction(user, network, channel, "is a potato", prefix);
        break;
    case "pong":
        IRCUtils.sendMessage(user, network, channel, "ping", prefix);
        break;
    case "releases":
        IRCUtils.sendMessage(user, network, channel, "https://goo.gl/4bNo6a", prefix);
        break;
    case "cookie":
        String nick = user.getNick();
        if (args.length >= 1) {
            nick = StringUtils.join(args, " ");
        }
        IRCUtils.sendAction(user, network, channel, "gives " + nick + " a cookie", prefix);
        break;
    case "license":
        IRCUtils.sendMessage(user, network, channel, "MIT License - https://goo.gl/KIiJeF", prefix);
        break;
    case "shrug":
        IRCUtils.sendMessage(user, network, channel, "?  \\_()_/  ?", prefix);
        break;
    case "source":
        IRCUtils.sendMessage(user, network, channel, "http://goo.gl/YP7t4N", prefix);
        break;
    case "permissions":
        IRCUtils.sendMessage(user, network, channel,
                "-4 Banned, -3 = Ignored by Everything except Relay, -2 = Ignored by Everything except Relay & Auto-Voice, -1 = Commands Ignored, 0 = Everyone, 1 = Registered, 5 = Voiced/Trusted, 7 = Channel Half-Operator, 10 = Operator, 13 = Protected Channel Operator, 15 = Senior Channel Operator, 18 = Channel Administrator, 20 = Network Administrator",
                prefix);
        break;
    default:
        IRCUtils.sendMessage(user, network, channel, "pong", prefix);

    }
}

From source file:com.blackducksoftware.integration.hub.api.component.ComponentQuery.java

public String getQuery() {
    final String idSegment = StringUtils.join(new String[] { "id", id }, ':');
    return StringUtils.join(new String[] { idSegment, groupId, artifactId, version }, '|');
}

From source file:com.l2jfree.status.commands.ClassStats.java

@Override
protected String getParameterUsage() {
    return StringUtils.join(SortBy.values(), "|").toLowerCase();
}