List of usage examples for org.apache.commons.lang.builder ReflectionToStringBuilder setAppendStatics
public void setAppendStatics(boolean appendStatics)
Sets whether or not to append static fields.
From source file:org.fornax.cartridges.sculptor.framework.domain.AbstractDomainObject.java
/** * Only "simple" types will be included in toString. Relations to other * domain objects can not be included since we don't know if they are * fetched and we don't wont toString to fetch them. * <p>/* ww w . j a v a2 s . c o m*/ * More intelligent implementation can be done in subclasses if needed. * Subclasses may also override {@link #acceptToString(Field)}. * <p> * The */ @Override public String toString() { try { ReflectionToStringBuilder builder = new ReflectionToStringBuilder(this, toStringStyle()) { @Override protected boolean accept(Field f) { if (super.accept(f)) { return acceptToString(f); } else { return false; } } }; builder.setAppendStatics(false); builder.setAppendTransients(true); return builder.toString(); } catch (RuntimeException e) { // toString is only used for debug purpose and // eventual exceptions should not be "ignored" return "RuntimeException in " + getClass().getName() + ".toString():" + e.getMessage(); } }