Example usage for org.apache.commons.lang.builder ToStringBuilder getDefaultStyle

List of usage examples for org.apache.commons.lang.builder ToStringBuilder getDefaultStyle

Introduction

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

Prototype

public static ToStringStyle getDefaultStyle() 

Source Link

Document

Gets the default ToStringStyle to use.

This could allow the ToStringStyle to be controlled for an entire application with one call.

This might be used to have a verbose ToStringStyle during development and a compact ToStringStyle in production.

Usage

From source file:edu.umn.msi.tropix.persistence.dao.hibernate.TropixObjectDaoImpl.java

@SuppressWarnings("unchecked")
private <T> T uniqueResult(final Query query, Class<T> resultType) {
    try {/*  w  w  w  .j a  v a2  s. c  om*/
        return (T) query.uniqueResult();
    } catch (final RuntimeException e) {
        final String queryString = ToStringBuilder.reflectionToString(query, ToStringBuilder.getDefaultStyle(),
                false, Query.class);
        final String message = String.format("Failed to fetch unique result for query %s", queryString);
        ExceptionUtils.logQuietly(LOG, e, message);
        throw e;
    }
}