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 ToStringStyle
through reflection." So, in what format does the default ToStringStyle
display dates?
Asked
Active
Viewed 3,147 times
1

skaffman
- 398,947
- 96
- 818
- 769

Derek Mahar
- 27,608
- 43
- 124
- 174
2 Answers
1
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.

Matthew Flaschen
- 278,309
- 50
- 514
- 539
0
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]

Jonathan Holloway
- 62,090
- 32
- 125
- 150
-
Jon, thank you for your answer, but this doesn't tell me how `ToStringStyle.DEFAULT_STYLE` displays a Java `Date`. – Derek Mahar Nov 16 '10 at 19:50