Example usage for org.apache.commons.lang3.builder ToStringStyle MULTI_LINE_STYLE

List of usage examples for org.apache.commons.lang3.builder ToStringStyle MULTI_LINE_STYLE

Introduction

In this page you can find the example usage for org.apache.commons.lang3.builder ToStringStyle MULTI_LINE_STYLE.

Prototype

ToStringStyle MULTI_LINE_STYLE

To view the source code for org.apache.commons.lang3.builder ToStringStyle MULTI_LINE_STYLE.

Click Source Link

Document

The multi line toString style.

Usage

From source file:com.omertron.slackbot.listeners.GoogleSheetsListener.java

/**
 * Create a simple formatted message about the future game night
 *
 * @param sheetInfo SheetInfo/*from  w  ww  .  j  a  v a 2 s . c o m*/
 * @param diff Days to next game night
 * @return Slack Prepared Message
 */
public static SlackPreparedMessage createSimpleNightMessage(SheetInfo sheetInfo, Period diff) {
    SlackPreparedMessage.Builder spm = new SlackPreparedMessage.Builder().withUnfurl(false);

    StringBuilder sb = new StringBuilder("Game night is ");
    sb.append(sheetInfo.getFormattedDate("EEEE, d MMMM")).append(", still ").append(diff.getDays())
            .append(" days away\n");

    if (StringUtils.isBlank(sheetInfo.getGameChooser())) {
        sb.append("There is no-one to chose the next game!!! :astonished:");
    } else {
        if ("All".equalsIgnoreCase(sheetInfo.getGameChooser())) {
            sb.append("The group is choosing :open_mouth:");
        } else if ("Other".equalsIgnoreCase(sheetInfo.getGameChooser())) {
            sb.append("It's someone else's turn to choose :open_mouth:");
        } else {
            sb.append("It's *").append(sheetInfo.getGameChooser()).append("'s* turn to choose");
        }

        if (sheetInfo.getNextGameId() <= 0) {
            // There's no game ID, this could be because there's no game selected or an error reading
            if (StringUtils.isBlank(sheetInfo.getGameName())) {
                // No game chosen
                LOG.error("SheetInfo READ:\n{}",
                        ToStringBuilder.reflectionToString(sheetInfo, ToStringStyle.MULTI_LINE_STYLE));
                sb.append(", but no game has been selected yet :angry:\n");
            } else {
                // Error with reading the sheet or with google's API
                sb.append(" and *").append(sheetInfo.getGameName()).append("* has been chosen.\n");
            }
        } else {
            sb.append(" and *").append(SlackBot.formatLink(Constants.BGG_LINK_GAME + sheetInfo.getNextGameId(),
                    sheetInfo.getGameName())).append("* has been picked.\n");
        }

    }

    // Who's attending?
    if (sheetInfo.getPlayers().isEmpty()) {
        sb.append("No-one has said they are going!");
    } else {
        sb.append(sheetInfo.getNameList(", ")).append(" are attending");
    }

    spm.withMessage(sb.toString());

    return spm.build();
}

From source file:io.leishvl.core.dwc.simple.SimpleDarwinRecord.java

@Override
@Generated(value = "com.sun.tools.xjc.Driver", date = "2015-11-04T10:30:09+01:00", comments = "JAXB RI v2.2.11")
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

From source file:org.ahp.commons.util.AhpStringUtil.java

/**
 * /*  w  w w .j ava2s  .  c  o m*/
 * @param pObject
 * @return
 */
public static String reflectionToString(Object pObject) {
    return ToStringBuilder.reflectionToString(pObject, ToStringStyle.MULTI_LINE_STYLE);
}

From source file:org.apache.syncope.common.to.UserTO.java

@Override
public String toString() {
    return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) {

        @Override/*from  w  ww.j  av  a2 s .c o m*/
        protected boolean accept(final Field f) {
            return super.accept(f) && !f.getName().equals("password");
        }
    }.toString();
}

From source file:org.apache.syncope.core.logic.report.AuditReportlet.java

private void doExtractConf(final ContentHandler handler) throws SAXException {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(datasource);
    jdbcTemplate.setMaxRows(conf.getSize());
    List<Map<String, Object>> rows = jdbcTemplate
            .queryForList("SELECT * FROM SYNCOPEAUDIT ORDER BY EVENT_DATE DESC");

    handler.startElement("", "", "events", null);
    AttributesImpl atts = new AttributesImpl();
    for (Map<String, Object> row : rows) {
        AuditEntry auditEntry = POJOHelper.deserialize(row.get("MESSAGE").toString(), AuditEntry.class);

        atts.clear();//from   w w w.  java 2 s  .c  o  m
        if (StringUtils.isNotBlank(auditEntry.getWho())) {
            atts.addAttribute("", "", "who", ReportXMLConst.XSD_STRING, auditEntry.getWho());
        }
        handler.startElement("", "", "event", atts);

        atts.clear();
        if (StringUtils.isNotBlank(auditEntry.getLogger().getCategory())) {
            atts.addAttribute("", "", "category", ReportXMLConst.XSD_STRING,
                    auditEntry.getLogger().getCategory());
        }
        if (StringUtils.isNotBlank(auditEntry.getLogger().getSubcategory())) {
            atts.addAttribute("", "", "subcategory", ReportXMLConst.XSD_STRING,
                    auditEntry.getLogger().getSubcategory());
        }
        if (StringUtils.isNotBlank(auditEntry.getLogger().getEvent())) {
            atts.addAttribute("", "", "event", ReportXMLConst.XSD_STRING, auditEntry.getLogger().getEvent());
        }
        if (auditEntry.getLogger().getResult() != null) {
            atts.addAttribute("", "", "result", ReportXMLConst.XSD_STRING,
                    auditEntry.getLogger().getResult().name());
        }
        handler.startElement("", "", "logger", atts);
        handler.endElement("", "", "logger");

        if (auditEntry.getBefore() != null) {
            char[] before = ToStringBuilder
                    .reflectionToString(auditEntry.getBefore(), ToStringStyle.MULTI_LINE_STYLE).toCharArray();
            handler.startElement("", "", "before", null);
            handler.characters(before, 0, before.length);
            handler.endElement("", "", "before");
        }

        if (auditEntry.getInput() != null) {
            handler.startElement("", "", "inputs", null);
            for (Object inputObj : auditEntry.getInput()) {
                char[] input = ToStringBuilder.reflectionToString(inputObj, ToStringStyle.MULTI_LINE_STYLE)
                        .toCharArray();
                handler.startElement("", "", "input", null);
                handler.characters(input, 0, input.length);
                handler.endElement("", "", "input");
            }
            handler.endElement("", "", "inputs");
        }

        if (auditEntry.getOutput() != null) {
            char[] output = ToStringBuilder
                    .reflectionToString(auditEntry.getOutput(), ToStringStyle.MULTI_LINE_STYLE).toCharArray();
            handler.startElement("", "", "output", null);
            handler.characters(output, 0, output.length);
            handler.endElement("", "", "output");
        }

        handler.startElement("", "", "throwable", null);
        char[] throwable = row.get("THROWABLE").toString().toCharArray();
        handler.characters(throwable, 0, throwable.length);
        handler.endElement("", "", "throwable");

        handler.endElement("", "", "event");
    }
    handler.endElement("", "", "events");
}

From source file:org.apache.syncope.core.util.VirAttrCacheKey.java

@Override
public String toString() {
    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE, true);
}

From source file:org.blocks4j.reconf.client.elements.ConfigurationItemElement.java

@Override
public String toString() {
    ToStringBuilder result = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("method",
            StringUtils.replace(getMethod().toString(), "public abstract ", ""));
    addToString(result, "product", getProduct());
    addToString(result, "component", getComponent());
    result.append("value", getValue());
    return result.toString();
}

From source file:org.blocks4j.reconf.client.elements.ConfigurationRepositoryElement.java

@Override
public String toString() {
    ToStringBuilder result = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("class", getInterfaceClass()).append("product", getProduct())
            .append("component", getComponent()).append("pollingRate", getRate())
            .append("pollingTimeUnit", getTimeUnit());
    if (!configurationItemListeners.isEmpty()) {
        List<ConfigurationItemListener> asList = new ArrayList<ConfigurationItemListener>(
                configurationItemListeners);
        for (int i = 0; i < asList.size(); i++) {
            result.append("item-listener-" + (i + 1), asList.get(i).getClass().getName());
        }/* ww  w. j  a va 2  s. c o m*/
    }

    result.append("@ConfigurationItems", LineSeparator.value() + getConfigurationItems());
    return result.toString();
}

From source file:org.blocks4j.reconf.client.setup.PropertiesConfiguration.java

@Override
public String toString() {
    ToStringBuilder result = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("local-cache", getLocalCacheSettings()).append("server", getConnectionSettings());
    if (experimentalFeatures) {
        result.append("experimental-features", experimentalFeatures);
    }/*from w  w  w  .j ava2s  .  c  o  m*/
    if (debug) {
        result.append("debug", debug);
    }
    return result.toString();
}

From source file:org.cgiar.ccafs.ap.config.APModule.java

@Override
public void configure(Binder binder) {
    // We are configuring google guice using annotation. However you can do it here if you want.
    binder.bind(Authenticator.class).annotatedWith(Names.named("LDAP")).to(LDAPAuthenticator.class);
    binder.bind(Authenticator.class).annotatedWith(Names.named("DB")).to(DBAuthenticator.class);

    // In addition, we are using this place to configure other stuffs.
    ToStringBuilder.setDefaultStyle(ToStringStyle.MULTI_LINE_STYLE);

    properties = new PropertiesManager();

    config = new APConfig(properties);
    LOG.info("----- DATABASE CONNECTION -----");
    LOG.info(properties.getPropertiesAsString(config.MYSQL_USER));

    LOG.info(properties.getPropertiesAsString(config.MYSQL_HOST));
    LOG.info(properties.getPropertiesAsString(config.MYSQL_DATABASE));
    LOG.info("----- RESOURCE PATH --------");
    LOG.info(config.getResourcePath().getAbsolutePath());

}