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 <T> String join(final T... elements) 

Source Link

Document

Joins the elements of the provided array into a single String containing the provided list of elements.

No separator is added to the joined String.

Usage

From source file:net.eledge.android.toolkit.StringArrayUtils.java

public static boolean isNotBlank(String[] array) {
    return ((array != null) && (array.length > 0)) && StringUtils.join(array).trim().length() > 0;
}

From source file:net.lmxm.ute.utils.PathUtils.java

/**
 * Builds the full path.//  w w  w.  jav  a  2 s .c  om
 * 
 * @param rootPath the root path
 * @param relativePath the relative path
 * @return the string
 */
public static String buildFullPath(final String rootPath, final String relativePath) {
    final String prefix = "buildFullPath() :";

    LOGGER.debug("{} entered, root={}, relativepath=" + relativePath, prefix, rootPath);

    final String root = StringUtils.removeEnd(StringUtils.trimToEmpty(rootPath), "/");
    final String relative = StringUtils.removeStart(StringUtils.trimToEmpty(relativePath), "/");

    String fullPath;

    if (StringUtils.isBlank(relative)) {
        fullPath = root;
    } else {
        fullPath = StringUtils.join(new Object[] { root, "/", relative });
    }

    LOGGER.debug("{} returning {}", prefix, fullPath);

    return fullPath;
}

From source file:io.cyberstock.tcdop.server.integration.digitalocean.adapter.impl.DOAdapterUtils.java

public static String modifySSHKeyName(String name) {
    String[] nameRaw = name.split("_");
    String indexStr = nameRaw[nameRaw.length - 1];

    Integer index = 2;/*from  ww  w  .  j  a va  2 s.  co  m*/
    if (StringUtils.isNumeric(indexStr)) {
        try {
            index = Integer.parseInt(indexStr) + 1;
            nameRaw = Arrays.copyOf(nameRaw, nameRaw.length - 1);
        } catch (IllegalFormatException e) {
            //nop
        }
    }

    return StringUtils.join(nameRaw) + "_" + index;
}

From source file:gov.nyc.doitt.gis.geoclient.service.web.MissingAnyOfOptionalServletRequestParametersException.java

@Override
public String getMessage() {
    return String.format("This operation requires one of the following parameters: %s",
            StringUtils.join(parameters));
}

From source file:com.sandbox.recipe.domain.SearchCriteria.java

@Override
public String toString() {
    return "SearchCriteria[ " + "searchText: " + getSearchText() + ", cookbookIds: "
            + StringUtils.join(getCookbookIds()) + ", tags: " + StringUtils.join(getTags()) + " ]";
}

From source file:com.thoughtworks.go.util.comparator.AlphaAsciiCollectionComparator.java

private String string(Collection<? extends Comparable<T>> other) {
    ArrayList<Comparable> others = new ArrayList<>(other);
    Collections.sort(others);/*from  w  w  w  .  j  a v a  2s. c om*/
    return StringUtils.join(others.toArray());
}

From source file:dk.dma.ais.packet.AisTestPackets.java

private static AisPacket read(String... lines) {
    try {//from   ww  w.jav a 2 s. co  m
        return AisPacket.readFromString(StringUtils.join(lines));
    } catch (SentenceException e) {
        throw new Error(e);
    }
}

From source file:com.amazon.kinesis.streaming.agent.processing.processors.SingleLineDataConverter.java

@Override
public ByteBuffer convert(ByteBuffer data) throws DataConversionException {
    String dataStr = ByteBuffers.toString(data, StandardCharsets.UTF_8);
    String[] lines = dataStr.split(NEW_LINE);
    for (int i = 0; i < lines.length; i++) {
        // FIXME: Shall we trim each line?
        lines[i] = lines[i].trim();//from   ww  w .j a v a  2  s  .  c  o m
    }

    String dataRes = StringUtils.join(lines) + NEW_LINE;
    return ByteBuffer.wrap(dataRes.getBytes(StandardCharsets.UTF_8));
}

From source file:ee.ria.xroad.signer.tokenmanager.token.HardwareTokenType.java

@Override
public String getId() {
    return CryptoUtils.encodeHex(
            StringUtils.join(new Object[] { moduleType, slotIndex, serialNumber, label }).getBytes());
}

From source file:com.jdom.axis.and.allies.view.DetailsViewActivity.java

@SuppressWarnings("unchecked")
private void writeOutCountries(PlayableCountry playableCountry, int countriesViewId) {
    TextView textView = (TextView) findViewById(countriesViewId);
    textView.setText(StringUtils.join(playableCountry.getOwnedTerritories()));
}