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.google.mr4c.util.PathUtils.java

/**
  * Takes the elements of one path and prepends any elements that are missing in another path
*///from  w w w .java  2 s. co m
public static String prependMissingPathElements(String path, String otherPath, String separator) {

    List<String> pathElements = Arrays.asList(StringUtils.split(path, separator));
    List<String> otherElements = Arrays.asList(StringUtils.split(otherPath, separator));
    List<String> toAdd = new ArrayList<String>();
    for (String element : otherElements) {
        if (!pathElements.contains(element)) {
            toAdd.add(element);
        }
    }
    List<String> newElements = new ArrayList<String>();
    newElements.addAll(toAdd);
    newElements.addAll(pathElements);
    return StringUtils.join(newElements, separator);
}

From source file:com.googlecode.jsendnsca.encryption.Encryption.java

public static String supportedList() {
    return StringUtils.join(Encryption.values(), ',');
}

From source file:com.threewks.thundr.proxy.http.Response.java

public static Response from(HttpResponse response) {
    int status = response.getStatus();

    Map<String, String> headers = new HashMap<String, String>();
    Map<String, List<String>> responseHeaders = response.getHeaders();
    for (String name : responseHeaders.keySet()) {
        if (name == null) {
            continue;
        }/*  w  ww.  j ava 2s .co  m*/
        String value = StringUtils.join(responseHeaders.get(name), ",");
        headers.put(name, value);
    }

    byte[] body = response.getBodyAsBytes();
    if (body != null && body.length == 0) {
        body = null;
    }

    return new Response().status(status).headers(headers).body(body);
}

From source file:flens.util.MVELUtil.java

public static String reverseHostname(String hostname) {
    String[] parts = hostname.split("[.]");
    ArrayUtils.reverse(parts);/*from www  . java2s  .  c  o  m*/
    return StringUtils.join(parts, ".");
}

From source file:ezbake.persist.FilePersist.java

public static String joinPath(String... paths) {
    return StringUtils.join(paths, File.separatorChar);
}

From source file:com.creditcloud.ump.model.ump.utils.UmpUtils.java

public static String agreementTypesToString(UmpAgreementType... types) {
    List<String> agreementNames = new ArrayList<>();
    if (types != null) {
        for (UmpAgreementType type : types) {
            agreementNames.add(type.name());
        }//from  w ww  .  j  a  va2  s .  com
    }
    return StringUtils.join(agreementNames, "|");
}

From source file:hydrograph.engine.cascading.scheme.hive.parquet.HiveParquetSchemeHelper.java

public static List<TypeInfo> getColumnsDataTypes(HiveTableDescriptor hiveTableDescriptor) {
    String dataTypes = StringUtils.join(hiveTableDescriptor.getColumnTypes(), ":");
    return TypeInfoUtils.getTypeInfosFromTypeString(dataTypes);
}

From source file:com.mirth.connect.donkey.server.data.ChannelDoesNotExistException.java

public ChannelDoesNotExistException(Set<String> channelIds) {
    super("The following channel IDs do not exist: " + StringUtils.join(channelIds, ", "));
    this.channelIds = channelIds;
}

From source file:com.hantsylabs.example.ee7.jpa.ListToStringConveter.java

@Override
public String convertToDatabaseColumn(List<String> attribute) {
    if (attribute == null || attribute.isEmpty()) {
        return "";
    }/*from w w  w.j  av a 2 s .  co  m*/
    return StringUtils.join(attribute, ",");
}

From source file:at.co.federmann.gtd.domain.Status.java

public static Status resolveStatus(Integer id) {
    if (id == null) {
        return null;
    }// w w w.j a va 2  s  . c  om
    for (Status status : Status.values()) {
        if (id.equals(status.id)) {
            return status;
        }
    }
    throw new IllegalArgumentException(StringUtils.join("No mathing Status found for id ", id));
}