开发者

In what format does ToStringBuilder.reflectionToString(Object) display dates?

In what format does ToStringBuilder.reflectionToString(Object) display dates? According to the Apache Commons Lang 2.4 documentation, ToStringBuilder.reflectionToString(Object) delegates to ReflectionToStringBuilder.toString(Object) which "Builds a toString value using the default ToStringSt开发者_JAVA百科yle through reflection." So, in what format does the default ToStringStyle display dates?


DefaultToStringStyle is just an immutable subclass of ToStringStyle, so it falls back on that for handling. ToStringStyle does not have any special handling for dates, so it just uses Date's toString.

However, there is actually an example of adding it.


public class ToStringBuilder {

    /**
     * The default style of output to use.
     */
    private static ToStringStyle defaultStyle = ToStringStyle.DEFAULT_STYLE;

The default toString style. Using the Person example from ToStringBuilder, the output would look like this:

Person@182f0db[name=John Doe,age=33,smoker=false]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜