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

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

Introduction

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

Prototype

public static String reflectionToString(Object object, ToStringStyle style, boolean outputTransients,
        Class reflectUpToClass) 

Source Link

Document

Forwards to ReflectionToStringBuilder.

Usage

From source file:de.smartics.maven.plugin.jboss.modules.descriptor.ApplyToDependencies.java

/**
 * {@inheritDoc}/*from   ww w . j  ava 2s. co  m*/
 * <p>
 * Provides the properties via reflection for displaying debug information.
 * </p>
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE, false, null);
}

From source file:de.smartics.maven.plugin.jboss.modules.descriptor.Directives.java

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

From source file:jext2.Inode.java

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE, false, Inode.class);
}

From source file:com.comphenix.protocol.error.DetailedErrorReporter.java

/**
 * Retrieve a string representation of the given object.
 * @param value - object to convert./*  w  ww . ja  v  a 2 s .co  m*/
 * @return String representation.
 */
public static String getStringDescription(Object value) {
    // We can't only rely on toString.
    if (value == null) {
        return "[NULL]";
    }
    if (isSimpleType(value) || value instanceof Class<?>) {
        return value.toString();
    } else {
        try {
            if (!apacheCommonsMissing)
                return ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null);
        } catch (LinkageError ex) {
            // Apache is probably missing
            apacheCommonsMissing = true;
        } catch (ThreadDeath | OutOfMemoryError e) {
            throw e;
        } catch (Throwable ex) {
            // Don't use the error logger to log errors in error logging (that could lead to infinite loops)
            ProtocolLogger.log(Level.WARNING, "Cannot convert to a String with Apache: " + ex.getMessage());
        }

        // Use our custom object printer instead
        try {
            return PrettyPrinter.printObject(value, value.getClass(), Object.class);
        } catch (IllegalAccessException e) {
            return "[Error: " + e.getMessage() + "]";
        }
    }
}

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 {/*from ww w.  j a  va2  s  . c  o m*/
        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;
    }
}