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 methodStringCollection(Collection<String> argument1) {
    return StringUtils.join(argument1, ":");
}

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

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

From source file:fp4f.floorplans.DatabaseLayer.java

ArrayList<AddressItem> getMatchingAddresses(String address) {
    ArrayList items = new ArrayList<AddressItem>();
    String[] params = address.trim().split(" ");
    ArrayList list = new ArrayList<String>();
    list.add("select * from houses");
    if (params.length > 0)
        list.add("where");

    for (int i = 0; i < params.length; i++) {
        list.add("address like ?");
        if (i + 1 != params.length)
            list.add("and");
    }/*w  ww.  ja  va  2 s  .c o  m*/
    list.add("order by address");
    String query = StringUtils.join(list.toArray(), " ");

    try {

        PreparedStatement getter = con.prepareStatement(query);
        for (int i = 0; i < params.length; i++) {
            getter.setString(i + 1, "%" + params[i] + "%");
        }
        ResultSet rs = getter.executeQuery();
        while (rs.next()) {
            AddressItem item = new AddressItem();
            item.Address = rs.getString("address");
            item.HouseId = rs.getInt("id");
            items.add(item);
        }
    } catch (Exception ex) {
        System.out.println(ex);
    }
    return items;
}

From source file:com.astamuse.asta4d.util.IdGenerator.java

/**
 * a unique id with thread id embedded and a thread unique number
 * //from   ww  w.j  a  v  a 2  s  .  c  om
 * @return
 */
// TODO we want a fast uuid solution
public final static String createId() {
    IdHolder idHolder = idHolderCache.get();
    long time = idHolder.newTime();
    Object[] vals = { time, idHolder.getThreadId(), randomSeed };
    return StringUtils.join(vals, "-");
}

From source file:com.jdom.word.playdough.model.GamePackPlayerSerializerImpl.java

public Properties serialize(Jumble jumble) {
    Properties properties = new Properties();

    Map<String, Set<String>> wordsFoundMap = jumble.wordsFoundMap;

    for (String key : wordsFoundMap.keySet()) {
        Set<String> found = wordsFoundMap.get(key);
        String propertyLine = StringUtils.join(found, PropertiesUtil.SEPARATOR);

        properties.setProperty(key + FOUND_WORDS_SUFFIX, propertyLine);
    }/*  w ww . j  av a2  s .c  o m*/

    for (String key : jumble.scoreMap.keySet()) {
        properties.setProperty(key + SCORE_SUFFIX, "" + jumble.scoreMap.get(key));
    }

    properties.setProperty(CURRENT_WORD, jumble.currentWord);

    return properties;
}

From source file:de.tuberlin.uebb.jbop.optimizer.methodsplitter.VarList.java

@Override
public String toString() {
    return StringUtils.join(this, ", ");
}

From source file:com.comcast.viper.flume2storm.location.SimpleStaticLocationServiceTest.java

private static String buildPName(String... elements) {
    return StringUtils.join(elements, ".");
}

From source file:com.liferay.blade.cli.ShellCommand.java

public void execute() throws Exception {
    if (!Util.canConnect(_host, _port)) {
        addError("sh", "Unable to connect to gogo shell on " + _host + ":" + _port);

        return;// ww  w .  j a  v  a2s  .com
    }

    String gogoCommand = StringUtils.join(_options._arguments(), " ");

    executeCommand(gogoCommand);
}

From source file:com.hulaki.smtp.api.RelayRequest.java

public RelayRequest(String requestBody) throws ApiProtocolException {
    super(requestBody, ApiCommand.RELAY);
    String[] tokens = requestBody.split(" ");
    if (tokens.length == 2) {
        this.relayMode = RelayMode.parse(tokens[1]);
    } else if (tokens.length == 3) {
        this.relayMode = RelayMode.parse(tokens[1]);
        this.recipient = EmailUtils.normalizeEmailAddress(tokens[2]);
    } else {// w  ww. j a va  2 s  .c o  m
        throw new ApiProtocolException("Invalid format. Should be in format: " + ApiCommand.RELAY.toString()
                + " [" + StringUtils.join(RelayMode.all(), "|") + "] [email-address]");
    }
}

From source file:com.ha.dailylab.PickListBean.java

public void showValues() {
    FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Select Values",
            StringUtils.join(cities.getTarget(), ","));
    RequestContext.getCurrentInstance().showMessageInDialog(message);
}