Example usage for org.apache.commons.lang3.builder ToStringBuilder reflectionToString

List of usage examples for org.apache.commons.lang3.builder ToStringBuilder reflectionToString

Introduction

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

Prototype

public static String reflectionToString(final Object object, final ToStringStyle style) 

Source Link

Document

Uses ReflectionToStringBuilder to generate a toString for the specified object.

Usage

From source file:com.omertron.omdbapi.tools.OmdbBuilder.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(params, ToStringStyle.SHORT_PREFIX_STYLE);
}

From source file:com.mpush.test.connection.body.BodyTest.java

private void decode(byte[] message) {
    HandshakeMessage handshakeMessage = new HandshakeMessage(null);
    handshakeMessage.decode(message);/*from w w  w  . j  av a  2  s.c  om*/
    System.out.println(ToStringBuilder.reflectionToString(handshakeMessage, ToStringStyle.MULTI_LINE_STYLE));
}

From source file:com.feilong.test.User.java

public String toString() {

    //      return "User [name=" + name + ", id=" + id + ", loves=" + Arrays.toString(loves) + ", date=" + date + ", money=" + money
    //            + ", attrMap=" + attrMap + ", nickName=" + Arrays.toString(nickName) + ", userInfo=" + userInfo + ", userAddresses="
    //            + Arrays.toString(userAddresses) + ", userAddresseList=" + userAddresseList + "]";
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

From source file:de.bmarwell.j9kwsolver.util.ResponseUtils.java

/**
 * Parses the response for fields to set.
 * @param response the response sent by the server.
 * @return the CaptchaReturn Object with
 * information about the captcha assigned.
 *//*from  w  w w  .j  a v a 2s  .c  om*/
private static CaptchaReturnExtended getExtendedFromResponse(final String response) {
    /* 
     * Extended response contains phrase keyword
     * ID|text|confirm|antwort|mouse=0|phrase=0|
     *     numeric=0|math=0|min_len=1|max_len=20|confirm=1|w|h|
     * e.g.
     * 11837102|text|||mouse=0|phrase=1|numeric=0|math=0|min_len=5|
     *     max_len=0|confirm=0|300|57|userstart=1387447122|
     *     startdate=1387447119|serverdate=1387447122|maxtimeout=35
     */
    RequestToURI.LOG.debug("Extended response: {}.", response);
    String[] splitresponse = StringUtils.splitPreserveAllTokens(response, '|');

    RequestToURI.LOG.debug("Splitresponse: {}.",
            ToStringBuilder.reflectionToString(splitresponse, ToStringStyle.MULTI_LINE_STYLE));

    /* Check item count */
    if (splitresponse.length < EXTENDED_ANSWER_MINLENGTH) {
        RequestToURI.LOG.warn("Extended response doesn't contain enough items");
        return null;
    }

    /* check first item is digits */
    if (!NumberUtils.isDigits(splitresponse[0])) {
        RequestToURI.LOG.error("Response's first item isn't a captcha id." + " Found {} instead.",
                splitresponse[0]);
        return null;
    }

    /* Now create captcha extended item and fill it */
    CaptchaReturnExtended cre = new CaptchaReturnExtended();
    cre.setCaptchaID(splitresponse[CaptchaReturn.Field.ID.getPosition()]);

    /* if text returned, set text */
    if (StringUtils.equals(splitresponse[CaptchaReturn.Field.TEXT.getPosition()], "text")) {
        RequestToURI.LOG.debug("Setting text captcha.");
        cre.setText(true);
    }

    /* Just confirm? */
    if (StringUtils.equals(splitresponse[CaptchaReturn.Field.CONFIRM.getPosition()], "text")) {
        cre.setConfirm(true);
    }

    /* Has solved text */
    if (StringUtils.isNotEmpty(splitresponse[CaptchaReturn.Field.CONFIRMTEXT.getPosition()])) {
        cre.setConfirmText(splitresponse[CaptchaReturn.Field.CONFIRMTEXT.getPosition()]);
    }

    /* Mouse event? */
    if (StringUtils.equals(splitresponse[CaptchaReturn.Field.MOUSE.getPosition()], "mouse=1")) {
        cre.setMouse(true);
    }

    // TODO: Add items

    return cre;
}

From source file:com.enablens.dfa.base.DcnmAuthToken.java

@Override
public final String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}

From source file:VOBackupFile.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
}

From source file:com.jk.util.JKObjectUtil.java

/**
 * To string.//from   www.  ja  va2  s.c o m
 *
 * @param object
 *            the object
 * @param useCurrentTostringIfAvailable
 *            the use current tostring if available
 * @return the string
 */
public static String toString(final Object object, boolean useCurrentTostringIfAvailable) {
    if (object == null) {
        return "[NULL]";
    }
    if (useCurrentTostringIfAvailable && isMethodDirectlyExists(object, "toString")) {
        return object.toString();
    }
    return ToStringBuilder.reflectionToString(object, ToStringStyle.SHORT_PREFIX_STYLE);
}

From source file:gobblin.writer.http.AbstractHttpWriter.java

/**
 * Default implementation where any status code equal to or greater than 400 is regarded as a failure.
 * {@inheritDoc}/*from  w  ww . j a va2 s  .c  o m*/
 * @see gobblin.writer.http.HttpWriterDecoration#processResponse(org.apache.http.HttpResponse)
 */
@Override
public void processResponse(CloseableHttpResponse response) throws IOException, UnexpectedResponseException {
    if (response.getStatusLine().getStatusCode() >= 400) {
        if (response.getEntity() != null) {
            throw new RuntimeException("Failed. " + EntityUtils.toString(response.getEntity()) + " , response: "
                    + ToStringBuilder.reflectionToString(response, ToStringStyle.SHORT_PREFIX_STYLE));
        }
        throw new RuntimeException("Failed. Response: "
                + ToStringBuilder.reflectionToString(response, ToStringStyle.SHORT_PREFIX_STYLE));
    }
}

From source file:com.mirth.connect.model.DatabaseSettings.java

@Override
public String toAuditString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
}

From source file:com.zhuangjy.dao.ReflectionUtil.java

/**
 * ??toString()????logger debug/*from  www  .  ja  v  a  2  s. c  o m*/
 * 
 * @param obj
 *            ??
 * @return toString result
 * @since 2.0
 */
public static String objectToString(Object obj) {
    return ToStringBuilder.reflectionToString(obj, ToStringStyle.SHORT_PREFIX_STYLE);
}