ToStringBuilder 有自己的属性,style, 也有工具方法,直接代理了ReflectionToStringBuilder
// ReflectionToStringBuilder 非并发安全,需每次都new ReflectionToStringBuilder reflectionToStringBuilder = new ReflectionToStringBuilder(this, org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE) { @Override protected boolean accept(Field field) { boolean accept = super.accept(field); boolean accept2 = isAcceptRuntime(field); return accept && accept2; } private boolean isAcceptRuntime(Field field) { boolean accept = true; try { Object object = field.get(this); if (object instanceof String) { if (object != null && ((String) object).length() > 1024) { accept = false; LOGGER.info(" ignore field= " + field.getName() + " toString ,class=" + getClass().getName()); } } } catch (IllegalAccessException e) { throw new RuntimeException(e); } return accept; } }; return reflectionToStringBuilder.toString();