[url]http://www.oschina.net/code/snippet_55970_16171[/url]
public String toString(){
ReflectionToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE);
//去掉不需要打印出的属性 使用正则去掉类名和【】
return ReflectionToStringBuilder.toStringExclude(this,"memberId","userId","regDate",
"unregDate","memberStatus").replaceAll("(\\w+\\[)|\\]","");
}
public static String toString(Object obj){
return toString(obj, ToStringStyle.MULTI_LINE_STYLE);
}
public static String toString(Object obj, ToStringStyle stringStyle){
return ReflectionToStringBuilder.toString(obj, stringStyle);
}