2022
06-13
06-13
Java toString方法重写工具之ToStringBuilder案例详解
apache的commons-lang3的工具包里有一个ToStringBuilder类,这样在打日志的时候可以方便的打印出类实例中的各属性的值。具体用法如下:importorg.apache.commons.lang3.builder.ToStringBuilder;importorg.apache.commons.lang3.builder.ToStringStyle;publicclassMessage{privateStringfrom;privateStringto;privateStringbody;publicStringgetFrom(){returnfrom;}publicvoidsetFrom(Stringfrom)...
继续阅读 >