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:de.micromata.mgc.jpa.hibernatesearch.impl.LuceneDebugUtils.java

public String getIndexDescription(SearchEmgrFactory<?> emfac, Class<?> entityClass) {
    StringBuilder sb = new StringBuilder();
    emfac.runInTrans((emgr) -> {/*from w  ww .j a va 2s  . c  o  m*/
        sb.append("class: ").append(entityClass.getName()).append("\n");

        FullTextEntityManager femg = emgr.getFullTextEntityManager();
        SearchFactory sf = femg.getSearchFactory();
        IndexedTypeDescriptor itd = sf.getIndexedTypeDescriptor(entityClass);
        List<String> fields = itd.getIndexedProperties().stream().map((desc) -> desc.getName())
                .collect(Collectors.toList());
        sb.append("\nFields: ").append(StringUtils.join(fields, ", ")).append("\n");

        IndexedTypeDescriptor descr = sf.getIndexedTypeDescriptor(entityClass);
        sb.append("\nIndexedTypeDescriptor: indexed: ").append(descr.isIndexed()).append("\nFields:\n");
        for (FieldDescriptor field : descr.getIndexedFields()) {
            sb.append("  ").append(field).append("<br?\n");
        }
        sb.append("\nProperties: \n");
        for (PropertyDescriptor ip : descr.getIndexedProperties()) {
            sb.append("  ").append(ip).append("\n");
        }

        sb.append("\nIndexe: \n");
        for (IndexDescriptor ides : descr.getIndexDescriptors()) {
            sb.append("  ").append(ides).append("\n");
        }

        String[] sfields = getSearchFieldsForEntity(emfac, entityClass);
        sb.append("\nSearchFields: ").append(StringUtils.join(sfields, ",")).append("\n");
        return null;
    });
    return sb.toString();
}

From source file:com.github.rvesse.airline.examples.modules.ModuleReuse.java

@Override
public int run() {
    if (!help.showHelpIfRequested()) {
        System.out.println("Verbosity is " + verbosity.verbosity);
        System.out.println("Arguments were " + StringUtils.join(args, ", "));
    }/*  w  w w  . jav a2 s .  c om*/
    return 0;
}

From source file:knowledgeMiner.mining.ExtractionPattern.java

@Override
public String toString() {
    StringBuilder buffer = new StringBuilder();
    buffer.append("[" + StringUtils.join(posTypes_, ' ') + "]");
    buffer.append("=");
    buffer.append("\"" + StringUtils.join(parseArgs_, '|') + "\"");
    return buffer.toString();
}

From source file:com.adobe.acs.commons.reports.models.TagReportCellCSVExporter.java

@Override
public String getValue(Object result) {

    Resource resource = (Resource) result;

    TagManager tagMgr = resource.getResourceResolver().adaptTo(TagManager.class);

    log.debug("Loading tags from {}@{}", resource.getPath(), property);
    List<String> tags = new ArrayList<String>();
    String[] values = resource.getValueMap().get(property, String[].class);
    if (values != null) {
        for (String value : values) {
            tags.add(tagMgr.resolve(value).getTitle());
        }// w  w  w .j  a  v a 2 s  .  c  o  m
    }
    log.debug("Loaded {} tags", tags);

    return StringUtils.join(tags, ";");
}

From source file:com.lyncode.jtwig.tree.value.OperationBinary.java

public String toString() {
    List<String> results = new ArrayList<String>();
    if (!operands.getList().isEmpty()) {
        results.add(getDescription(0));/*www .ja v a  2 s  . c  o m*/
        for (int i = 1; i < operands.getList().size(); i++) {
            results.add(operators.get(i - 1).toString());
            results.add(getDescription(i));
        }
    } else
        return "Binary operation without operands";

    return StringUtils.join(results, " ");
}

From source file:com.deveo.android.ProjectSCMFragment.java

@Override
public void onResume() {
    super.onResume();

    Map<String, String> options = new HashMap<String, String>();
    options.put(Event.ATTR_PROJECT, getActivity().getIntent().getStringExtra(ProjectActivity.PARAM_PROJECT_ID));
    options.put(Event.ATTR_TARGET, StringUtils.join(TARGETS, ","));
    options.put(APIUtils.ATTR_EXPAND, Event.ATTR_SUBJECT);

    loadEvents(options);//from  ww  w  .j av  a2s.co  m
}

From source file:com.netflix.genie.common.dto.JobTest.java

/**
 * Test to make sure can build a valid Job using the builder.
 *///from w  w w  . j  a  v a2 s  .  c o  m
@Test
@SuppressWarnings("deprecation")
public void canBuildJobDeprecatedConstructor() {
    final Job job = new Job.Builder(NAME, USER, VERSION, StringUtils.join(COMMAND_ARGS, StringUtils.SPACE))
            .build();
    Assert.assertThat(job.getName(), Matchers.is(NAME));
    Assert.assertThat(job.getUser(), Matchers.is(USER));
    Assert.assertThat(job.getVersion(), Matchers.is(VERSION));
    Assert.assertThat(job.getCommandArgs().orElseThrow(IllegalArgumentException::new),
            Matchers.is(StringUtils.join(COMMAND_ARGS, StringUtils.SPACE)));
    Assert.assertFalse(job.getArchiveLocation().isPresent());
    Assert.assertFalse(job.getClusterName().isPresent());
    Assert.assertFalse(job.getCommandName().isPresent());
    Assert.assertFalse(job.getFinished().isPresent());
    Assert.assertFalse(job.getStarted().isPresent());
    Assert.assertThat(job.getStatus(), Matchers.is(JobStatus.INIT));
    Assert.assertFalse(job.getStatusMsg().isPresent());
    Assert.assertFalse(job.getCreated().isPresent());
    Assert.assertFalse(job.getDescription().isPresent());
    Assert.assertFalse(job.getId().isPresent());
    Assert.assertThat(job.getTags(), Matchers.empty());
    Assert.assertFalse(job.getUpdated().isPresent());
    Assert.assertThat(job.getRuntime(), Matchers.is(Duration.ZERO));
    Assert.assertThat(job.getGrouping(), Matchers.is(Optional.empty()));
    Assert.assertThat(job.getGroupingInstance(), Matchers.is(Optional.empty()));
}

From source file:exm.stc.ic.ICUtil.java

/**
 * print a comma separated list of var names to sb
 * @param sb/*from  w  w w .j a  v a  2  s  .c  o m*/
 * @param vars
 */
public static void prettyPrintVarList(StringBuilder sb, Collection<Var> vars) {
    sb.append(StringUtils.join(Var.nameList(vars), ", "));
}

From source file:jease.cms.domain.property.ScriptProperty.java

public String toString() {
    return StringUtils.join(getValue(), "\n");
}

From source file:alfio.manager.system.MailgunMailer.java

private RequestBody prepareBody(Event event, String to, List<String> cc, String subject, String text,
        Optional<String> html, Attachment... attachments) throws IOException {

    String from = event.getDisplayName() + " <" + configurationManager
            .getRequiredValue(Configuration.from(event.getOrganizationId(), event.getId(), MAILGUN_FROM)) + ">";

    if (ArrayUtils.isEmpty(attachments)) {
        FormBody.Builder builder = new FormBody.Builder().add("from", from).add("to", to)
                .add("subject", subject).add("text", text);
        if (cc != null && !cc.isEmpty()) {
            builder.add("cc", StringUtils.join(cc, ','));
        }/*from  w w  w.  j a  va2s  . c o m*/

        String replyTo = configurationManager.getStringConfigValue(
                Configuration.from(event.getOrganizationId(), event.getId(), MAIL_REPLY_TO), "");
        if (StringUtils.isNotBlank(replyTo)) {
            builder.add("h:Reply-To", replyTo);
        }
        html.ifPresent((htmlContent) -> builder.add("html", htmlContent));
        return builder.build();

    } else {
        MultipartBody.Builder multipartBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);

        multipartBuilder.addFormDataPart("from", from).addFormDataPart("to", to)
                .addFormDataPart("subject", subject).addFormDataPart("text", text);

        if (cc != null && !cc.isEmpty()) {
            multipartBuilder.addFormDataPart("cc", StringUtils.join(cc, ','));
        }

        html.ifPresent((htmlContent) -> multipartBuilder.addFormDataPart("html", htmlContent));

        for (Attachment attachment : attachments) {
            byte[] data = attachment.getSource();
            multipartBuilder.addFormDataPart("attachment", attachment.getFilename(), RequestBody
                    .create(MediaType.parse(attachment.getContentType()), Arrays.copyOf(data, data.length)));
        }
        return multipartBuilder.build();
    }
}