Posted on 2011-05-04
Medium Priority
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
  • 2
LVL 47

Expert Comment

ID: 35694855

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

Accepted Solution

for_yan earned 1000 total points
ID: 35694878
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

objects earned 1000 total points
ID: 35694939
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
A solution for Fortify Path Manipulation.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 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