Posted on 2011-05-04
Last Modified: 2012-05-11
I would like to know what is 'ReflectionToStringBuilder'. when do we use it. I see usage like ReflectionToStringBuilder.toString.
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.
Question by:gudii9
    LVL 47

    Expert Comment


    I think this gives a good explanation when you nedd this class:
    LVL 47

    Accepted Solution

    ReflectionToStringBuilder is a class which helps you to create toString()
    method for the object which has many fields and you want
    to combine their values into the String which will represent the insnatce
    of this class

    When ther are many fields - this may be tedious.
    This class uses Reflection , i.e. java facility to analyze any class and discover, in particulr,
    which fields it has and even determine thioer values for a particular instance
    - so it is undertstandable that such facility can help you cretae toString()
    method automatically rather than writing code manually
    LVL 92

    Assisted Solution

    Its for implementing toString() methods.
    The toString() method is useful to have in your bean for logging to show the property values of your bean.
    Instead of implementing it yourself you can use ReflectionToStringBuilder which uses reflection to determine the properties of your bean and return a string representation of the bean

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now