You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Brian Buckley <br...@comcast.net> on 2003/07/16 17:29:25 UTC

ToStringBuilder.reflectionToString

Hello,

Is there a good way to customize ToStringBuilder.reflectionToString based on
the type of field?

For example, if a class contains a field of type java.util.Date, how can one
make ToStringBuilder.reflectionToString use a custom SimpleDateFormatter on
the field instead of Date's toString()?

[java.text.SimpleDateFormat("yyyy-MM-dd").format(myField) instead of
myField.toString();]

I saw some customization options in ToStringStyle but did not see an option
to customize formatting by type of field.

Any tips appreciated.  Thanks.

Brian



Re: ToStringBuilder.reflectionToString

Posted by Henri Yandell <ba...@generationjava.com>.
Sorry. I funnel 'lang' into another folder so wasn't expecting Brian to
have re-sent with a [lang] when I moderated his previous mail.

My fault,

Hen

On Wed, 16 Jul 2003, Brian Buckley wrote:

> Hello,
>
> Is there a good way to customize ToStringBuilder.reflectionToString based on
> the type of field?
>
> For example, if a class contains a field of type java.util.Date, how can one
> make ToStringBuilder.reflectionToString use a custom SimpleDateFormatter on
> the field instead of Date's toString()?
>
> [java.text.SimpleDateFormat("yyyy-MM-dd").format(myField) instead of
> myField.toString();]
>
> I saw some customization options in ToStringStyle but did not see an option
> to customize formatting by type of field.
>
> Any tips appreciated.  Thanks.
>
> Brian
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>