Example usage for org.apache.commons.lang StringUtils join

List of usage examples for org.apache.commons.lang StringUtils join

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils join.

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

Joins the elements of the provided Collection into a single String containing the provided elements.

Usage

From source file:com.bigdata.dastor.io.SSTable.java

protected static String compactedFilename(String dataFile) {
    String[] parts = dataFile.split("-");
    parts[parts.length - 1] = "Compacted";
    return StringUtils.join(parts, "-");
}

From source file:com.hp.autonomy.hod.client.api.textindex.query.content.GetContentRequestBuilder.java

/**
 * @return A map of query parameters suitable for use with {@link GetContentBackend}. get is NOT supported on
 * the resulting map//from   ww  w . j  a v a2  s  .c o m
 */
Map<String, Object> build() {
    final Map<String, Object> map = new MultiMap<>();
    map.put("highlight_expression", highlightExpression);
    map.put("start_tag", startTag);
    map.put("end_tag", endTag);
    map.put("print", print);
    map.put("print_fields", StringUtils.join(printFields, ','));
    map.put("summary", summary);
    map.put("security_info", securityInfo);

    return map;
}

From source file:ee.ria.xroad.common.certificateprofile.impl.AbstractCertificateProfileInfo.java

@Override
public X500Principal createSubjectDn(DnFieldValue[] values) {
    return new X500Principal(
            StringUtils.join(Arrays.stream(values).map(this::toString).collect(Collectors.toList()), ", "));
}

From source file:gov.nih.nci.cabig.caaers.domain.expeditedfields.UnsatisfiedProperty.java

/**
 * This method will return a qualified display name.
 * ie. displayname [parent]~displayname [current node]
 *
 * @return the display name// w  ww  .  j  a  v a 2  s.  com
 */
public String getDisplayName() {
    ArrayList<String> displayNameList = new ArrayList<String>();

    TreeNode node = treeNode;
    while (node != null && node instanceof PropertyNode && StringUtils.isNotEmpty(node.getDisplayName())) {
        displayNameList.add(node.getDisplayName());
        node = node.getParent();
    }
    Collections.reverse(displayNameList);
    return StringUtils.join(displayNameList, "~");

}

From source file:com.github.hexocraft.random.items.command.RiCommandAdd.java

public RiCommandAdd(RandomItemsPlugin plugin) {
    super("add", plugin);
    this.setAliases(Lists.newArrayList("a"));
    this.setDescription(StringUtils.join(plugin.messages.cAdd, "\n"));
    this.setPermission(Permissions.CREATE.toString());

    this.addArgument(new CommandArgument<String>("name", ArgTypeRandomPool.get(), true, true,
            plugin.messages.cAddArgName));
    this.addArgument(new CommandArgument<Integer>("weight", ArgTypeInteger.get(), true, true,
            plugin.messages.cAddArgWeight));
    this.addArgument(new CommandArgument<String>("Description", ArgTypeString.get(), false, false,
            plugin.messages.cAddArgDesc));
}

From source file:com.inmobi.grill.driver.hive.HiveQueryPlan.java

public HiveQueryPlan(List<String> explainOutput, QueryPrepareHandle prepared, HiveConf conf)
        throws HiveException {
    setPrepareHandle(prepared);/*from   w  w  w .j  a  va 2 s.c  o  m*/
    setExecMode(ExecMode.BATCH);
    setScanMode(ScanMode.PARTIAL_SCAN);
    partitions = new LinkedHashMap<String, List<String>>();
    extractPlanDetails(explainOutput, conf);
    this.explainOutput = StringUtils.join(explainOutput, '\n');
}

From source file:ch.epfl.data.squall.components.AbstractComponent.java

private static String makeName(Component[] parents) {
    ArrayList<String> names = new ArrayList<String>();
    for (Component parent : parents) {
        names.add(parent.getName());//from   ww  w .ja v  a  2 s.  c o  m
    }
    return StringUtils.join(names, "_");
}

From source file:com.greenline.guahao.web.module.common.interceptor.MethodExecuteTimeInterceptor.java

@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    //  commons-lang ?? StopWatch Spring ?? StopWatch
    StopWatch clock = new StopWatch();
    clock.start(); // 
    Object result = invocation.proceed();
    clock.stop(); // ?

    // ????// ww w  .  j  ava2  s .  co m
    Class<?>[] params = invocation.getMethod().getParameterTypes();
    String[] simpleParams = new String[params.length];
    for (int i = 0; i < params.length; i++) {
        simpleParams[i] = params[i].getSimpleName();
    }
    logger.info(":" + clock.getTime() + " ms [" + invocation.getThis().getClass().getName()
            + "." + invocation.getMethod().getName() + "(" + StringUtils.join(simpleParams, ",") + ")] ");
    return result;
}

From source file:com.qspin.qtaste.util.PythonHelper.java

/**
 * Executes a python script, returning its output or not.
 *
 * @param fileName the filename of the python script to execute
 * @param redirectOutput true to redirect outputs and return them, false otherwise
 * @param arguments the arguments to pass to the python script
 * @return the output of the python script execution (combined standard and error outputs) or null if outputs were not
 * redirected//from  ww w .j  av  a  2  s. c  o m
 * @throws PyException in case of exception during Python script execution
 */
public static String execute(String fileName, boolean redirectOutput, String... arguments) throws PyException {
    Properties properties = new Properties();
    properties.setProperty("python.home", StaticConfiguration.JYTHON_HOME);
    properties.setProperty("python.path", StaticConfiguration.FORMATTER_DIR);
    PythonInterpreter.initialize(System.getProperties(), properties, new String[] { "" });

    try (PythonInterpreter interp = new PythonInterpreter(new org.python.core.PyStringMap(),
            new org.python.core.PySystemState())) {
        StringWriter output = null;
        if (redirectOutput) {
            output = new StringWriter();
            interp.setOut(output);
            interp.setErr(output);
        }
        interp.cleanup();
        interp.exec("import sys;sys.argv[1:]= [r'" + StringUtils.join(arguments, "','") + "']");
        interp.exec("__name__ = '__main__'");
        interp.exec("execfile(r'" + fileName + "')");
        return redirectOutput ? output.toString() : null;
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.solr.SolrQueryUtils.java

/**
 * Glue these words together into a query on a given field, joined by either
 * AND or OR./*from www  .jav  a 2 s  . co  m*/
 */
public static String assembleConjunctiveQuery(String fieldName, Collection<String> words, Conjunction c) {
    List<String> terms = new ArrayList<String>();
    for (String word : words) {
        terms.add(buildTerm(fieldName, word));
    }
    String q = StringUtils.join(terms, c.joiner());
    return q;
}