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:exm.stc.tclbackend.tree.Proc.java

@Override
public void appendTo(StringBuilder sb) {
    indent(sb);//from  ww w  .java 2s  .  c  om
    sb.append("\nproc ");
    sb.append(name);
    sb.append(" { ");
    sb.append(StringUtils.join(args, " "));
    sb.append(" } {\n");
    body.setIndentation(indentation + indentWidth);
    body.appendTo(sb);
    sb.append("}\n\n");
}

From source file:com.quinsoft.zeidon.dbhandler.MysqlJdbcHandler.java

@Override
protected void releaseGenkeyLock() {
    for (int tries = 0; tries < 5; tries++) {
        try {/*from   w w  w.  j  av  a  2 s .c o  m*/
            executeSql("UNLOCK TABLES;");
            return;
        } catch (Exception e) {
            // Danger danger Will Robinson!  We couldn't delete the lock, which will
            // prevent anybody else from creating new entities.  Log a warning and try again.
            getTask().log().warn("Exception attempting to execute UNLOCK TABLES: %s\n     %s", e.getMessage(),
                    StringUtils.join(e.getStackTrace(), "\n     "));
        }

        try {
            Thread.sleep(tries * tries * 100);
        } catch (InterruptedException e2) {
            // Ignore this error.  If we somehow get a crazy error here we still want
            // to try and unlock the tables.
        }
        getTask().log().warn("Attempting to UNLOCK genkey tables again #%d.", tries);
    }

    // If we get here then we didn't acquire the lock.
    throw new GenkeyLockException("Unable to UNLOCK GENKEY lock.  See logs for possible explanation.");
}

From source file:net.bdew.neiaddons.ServerHandler.java

private void sendPlayerHello(EntityPlayer player) {
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setString("commands", StringUtils.join(handlers.keySet(), ';'));
    nbt.setInteger("version", NEIAddons.netVersion);
    PacketHelper.sendToClient("hello", nbt, (EntityPlayerMP) player);
}

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

public boolean validate(PipelineConfigSaveValidationContext validationContext) {
    pipelineConfig.validate(validationContext);
    pipelineCreationSpecificValidations(validationContext);

    validateDependencies(validationContext);
    boolean isValid = pipelineConfig.errors().isEmpty();
    PipelineConfigSaveValidationContext contextForChildren = validationContext.withParent(pipelineConfig);

    for (StageConfig stageConfig : pipelineConfig.getStages()) {
        isValid = stageConfig.validateTree(contextForChildren) && isValid;
        if (pipelineConfig.hasTemplateApplied()) {
            final List<ConfigErrors> allErrors = new ArrayList<>();
            new GoConfigGraphWalker(stageConfig).walk(new ErrorCollectingHandler(allErrors) {
                @Override//  w  w  w.  j av a  2  s  .c o  m
                public void handleValidation(Validatable validatable, ValidationContext context) {
                }
            });
            for (ConfigErrors error : allErrors) {
                pipelineConfig.errors().add("template", StringUtils.join(error.getAll(), ", "));
            }
        }
    }
    validateCyclicDependencies(validationContext);
    isValid = pipelineConfig.materialConfigs().validateTree(contextForChildren) && isValid;
    isValid = pipelineConfig.getParams().validateTree(contextForChildren) && isValid;
    isValid = pipelineConfig.getVariables().validateTree(contextForChildren) && isValid;
    if (pipelineConfig.getTrackingTool() != null)
        isValid = pipelineConfig.getTrackingTool().validateTree(contextForChildren) && isValid;
    if (pipelineConfig.getMingleConfig() != null)
        isValid = pipelineConfig.getMingleConfig().validateTree(contextForChildren) && isValid;
    if (pipelineConfig.getTimer() != null)
        isValid = pipelineConfig.getTimer().validateTree(contextForChildren) && isValid;
    return isValid;
}

From source file:com.github.xbn.examples.io.non_xbn.SudokuTxtFileDataXmpl.java

private static final String[] getAndOutputDataRow(String line) {
    String[] asNineElements = line.split(" ");
    for (int i = 0; i < asNineElements.length; i++) {
        if (asNineElements[i].equals(".")) {
            asNineElements[i] = " ";
        }//from w  w  w . j a v  a 2s  .  c  o  m
    }
    System.out.println(StringUtils.join(asNineElements, " "));
    return asNineElements;
}

From source file:com.googlecode.commons.swing.component.FormNotifier.java

private String generateMessages() {
    List<String> lines = new ArrayList<String>();
    for (Entry<Component, String> comp : invalidComponents.entrySet()) {
        String line = "";
        if (!StringUtils.isBlank(comp.getKey().getName())) {
            line += comp.getKey().getName() + ": ";
        }//from w w w  . java 2 s.c o m
        line += comp.getValue();
        lines.add(line);
    }

    String messages = "<html>" + StringUtils.join(lines, "<br/>") + "</html>";
    return messages;
}

From source file:com.thoughtworks.go.domain.config.Configuration.java

public String forDisplay(List<ConfigurationProperty> propertiesToDisplay) {
    ArrayList<String> list = new ArrayList<>();
    for (ConfigurationProperty property : propertiesToDisplay) {
        if (!property.isSecure()) {
            list.add(format("%s=%s", property.getConfigurationKey().getName().toLowerCase(),
                    property.getConfigurationValue().getValue()));
        }// w  ww.  j  av a  2 s . c o  m
    }
    return format("[%s]", StringUtils.join(list, ", "));
}

From source file:com.jdom.word.playdough.android.GamePackPlayerActivity.java

public void setMessages(List<String> messages) {
    String message = StringUtils.join(messages, IOUtils.LINE_SEPARATOR);
    TextView messageView = (TextView) findViewById(R.id.messages);
    messageView.setText(message);//from  w  ww.  j a va  2s .c  o  m
}

From source file:com.nexmo.client.auth.NexmoUnacceptableAuthException.java

private String generateErrorMessage() {
    SortedSet<String> availableTypes = new TreeSet<>();
    for (AuthMethod auth : this.availableAuths) {
        availableTypes.add(auth.getClass().getSimpleName());
    }/*  w  ww.  jav a  2  s  .co m*/

    SortedSet<String> acceptableTypes = new TreeSet<>();
    for (Class klass : this.acceptableAuthClasses) {
        acceptableTypes.add(klass.getSimpleName());
    }

    return String.format(
            "No acceptable authentication type could be found. Acceptable types are: %s. Supplied " + "types "
                    + "were: %s",
            StringUtils.join(acceptableTypes, ", "), StringUtils.join(availableTypes, ", "));
}

From source file:com.thoughtworks.go.util.command.ConsoleResult.java

public String outputAsString() {
    return StringUtils.join(output(), "\n");
}