Example usage for org.apache.commons.lang3.builder ReflectionToStringBuilder toString

List of usage examples for org.apache.commons.lang3.builder ReflectionToStringBuilder toString

Introduction

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

Prototype

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

Source Link

Document

Builds a toString value through reflection.

Usage

From source file:com.catalog.repository.dao.ArticleDaoImpl.java

@Override
public void updateArticle(Article article) throws DaoException {
    LOGGER.debug("Updating article");
    Article updateArticle = getArticle(article.getId());
    if (updateArticle != null) {
        updateArticle.setName(article.getName());
        updateArticle.setBarcode(article.getBarcode());
        updateArticle.setCreatedDate(article.getCreatedDate());
        updateArticle.setDeletedDate(article.getDeletedDate());
        updateArticle.setPhasedOutDate(article.getPhasedOutDate());
        updateArticle.setLongDescription(article.getLongDescription());
        updateArticle.setShortDescription(article.getShortDescription());
        updateArticle.setPrice(article.getPrice());
        getCurrentSession().update(updateArticle);
    } else {/* ww  w .j av a  2  s  .c o m*/
        String articleString = ReflectionToStringBuilder.toString(article, ToStringStyle.DEFAULT_STYLE);
        LOGGER.error("Article to update not found: {}", articleString);
        throw new DaoException("Article to update not found: " + articleString);
    }
}

From source file:com.catalog.repository.dao.ApplicationUserDaoImpl.java

@Override
public void updateApplicationUser(ApplicationUser user) throws DaoException {
    LOGGER.debug("Updating application user");
    ApplicationUser userToUpdate = getApplicationUser(user.getId());
    if (userToUpdate != null) {
        userToUpdate.setFirstName(user.getFirstName());
        userToUpdate.setGender(user.getGender());
        userToUpdate.setLastName(user.getLastName());
        userToUpdate.setPassword(user.getPassword());
        userToUpdate.setEmailAddress(user.getEmailAddress());
        userToUpdate.setAge(user.getAge());
        getCurrentSession().update(userToUpdate);
    } else {//w  w w .  jav a  2  s  .  c o m
        String userString = ReflectionToStringBuilder.toString(user, ToStringStyle.DEFAULT_STYLE);
        LOGGER.error("User to update not found: {}", userString);
        throw new DaoException("User to update not found: " + userString);
    }
}

From source file:com.blackducksoftware.integration.hub.api.item.HubItem.java

@Override
public String toString() {
    return ReflectionToStringBuilder.toString(this, RecursiveToStringStyle.JSON_STYLE);
}

From source file:MultilineRecursiveToStringStyle.java

@Override
public void appendDetail(StringBuffer buffer, String fieldName, Object value) {
    if (!ClassUtils.isPrimitiveWrapper(value.getClass()) && !String.class.equals(value.getClass())
            && accept(value.getClass())) {
        spaces += indent;/*from w w w.j  a  va2  s  .  c  o  m*/
        resetIndent();
        buffer.append(ReflectionToStringBuilder.toString(value, this));
        spaces -= indent;
        resetIndent();
    } else {
        super.appendDetail(buffer, fieldName, value);
    }
}

From source file:com.icoin.trading.tradeengine.application.command.order.OrderBookCommandHandler.java

@SuppressWarnings("unused")
@CommandHandler/* w  ww . j  a v  a 2  s .  c om*/
public void handleRefreshOrderBook(RefreshOrderBookPriceCommand command) {
    OrderBook orderBook = repository.load(command.getOrderBookId(), null);

    if (orderBook == null) {
        logger.warn("Orderbook is null for {}", command.getOrderBookId());
        return;
    }
    logger.info("Before refresh, order book status is: "
            + ReflectionToStringBuilder.toString(orderBook, ToStringStyle.SHORT_PREFIX_STYLE));
    orderExecutorHelper.refresh(orderBook);
    logger.info("After refresh, order book status is: "
            + ReflectionToStringBuilder.toString(orderBook, ToStringStyle.SHORT_PREFIX_STYLE));
}

From source file:com.github.dozermapper.core.util.LogMsgFactory.java

private String getLogOutput(Object object) {
    String output = "NULL";
    if (object == null) {
        return output;
    }//from   w  ww .ja  v a2  s .  c  o  m
    try {
        if (object.getClass().isArray() || Collection.class.isAssignableFrom(object.getClass())) {
            output = ReflectionToStringBuilder.toString(object, ToStringStyle.MULTI_LINE_STYLE);
        } else {
            output = object.toString();
        }
    } catch (RuntimeException e) {
        output = object.toString();
    }
    return output;
}

From source file:com.thoughtworks.go.http.mocks.MockHttpServletResponseAssert.java

public SELF hasCookie(String path, String name, String value, int maxAge, boolean secured, boolean httpOnly) {
    Cookie actualCookie = actual.getCookie(name);

    Cookie expectedCookie = new Cookie(name, value);
    expectedCookie.setDomain("");
    expectedCookie.setPath(path);/*w  ww . j a  va 2  s  . c  o  m*/
    expectedCookie.setMaxAge(maxAge);
    expectedCookie.setSecure(secured);
    expectedCookie.setHttpOnly(httpOnly);

    if (!EqualsBuilder.reflectionEquals(expectedCookie, actualCookie)) {
        this.as("cookie");

        throw Failures.instance().failure(info,
                shouldBeEqual(ReflectionToStringBuilder.toString(actualCookie, ToStringStyle.MULTI_LINE_STYLE),
                        ReflectionToStringBuilder.toString(expectedCookie, ToStringStyle.MULTI_LINE_STYLE),
                        info.representation()));
    }
    return myself;
}

From source file:com.google.uzaygezen.core.Assessment.java

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

From source file:com.indra.sofia2.ssapandroid.ssap.SSAPMessage.java

public String toString() {
    return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}

From source file:com.tao_harmony.fx2extend.journal.Journal.java

/**
 * toString(). ?.//  w  w  w  .j a v  a2  s .c  o  m
 *
 * @return
 */
@Override
public String toString() {
    return ReflectionToStringBuilder.toString(this, ToStringStyle.SIMPLE_STYLE);
}