Simplier solution :
@Override
public String toString() {
return ReflectionToStringBuilder.toStringExclude(this, "data");
}
If DefaultToStringStyle is doesn't fit your application needs, make sure to call
ReflectionToStringBuilder.setDefaultStyle(style);
at application start.
If you have more fields to exclude, just add them after or before "data"
@Override
public String toString() {
return ReflectionToStringBuilder.toStringExclude(this, "fieldX","data", "fieldY");
}