The Artima Developer Community
Sponsored Link

Java Buzz Forum
override toString() reflectively

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Marc Logemann

Posts: 594
Nickname: loge
Registered: Sep, 2002

Marc Logemann is founder of www.logentis.de a Java consultancy
override toString() reflectively Posted: Feb 25, 2005 11:36 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Marc Logemann.
Original Post: override toString() reflectively
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
Latest Java Buzz Posts
Latest Java Buzz Posts by Marc Logemann
Latest Posts From Marc's Java Blog

Advertisement

Sometimes it makes really sense to look at other peoples code, especially when you know that the target code was developed by a skilled developer.

As many others, i am regulary overriding toString() for a more human friendly object representation. Because being lazy, i never invested time to do it cleanly so i handcoded the needed attributes with descriptive text in there. Now i saw that:

    public String toString() {
        return ReflectionToStringBuilder.reflectionToString(this,
                ToStringStyle.MULTI_LINE_STYLE);
    }

is easier, faster, better and everything. As allways, its not the question if there are good solutions for certain problems, but where to look for. In this case, you should look for Commons-Lang from Apache to use this piece of code.

Read: override toString() reflectively

Topic: JHeadstart ADF Previous Topic   Next Topic Topic: UI Improvements-Eclipse3.1M5

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use