<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Generic toString Method for Simple Java Beans</title>
	<atom:link href="http://thejeshgn.com/2008/06/24/generic-tostring-method-for-simple-java-beans/feed/" rel="self" type="application/rss+xml" />
	<link>http://thejeshgn.com/2008/06/24/generic-tostring-method-for-simple-java-beans/</link>
	<description>A Blog, A Website and A container for all my views with excerpts from technology, travel, films, india, photography, kannada, friends and other interests. I am Thejesh GN. Friends call me Thej</description>
	<lastBuildDate>Wed, 08 Sep 2010 07:46:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Guido</title>
		<link>http://thejeshgn.com/2008/06/24/generic-tostring-method-for-simple-java-beans/comment-page-1/#comment-1437</link>
		<dc:creator>Guido</dc:creator>
		<pubDate>Sat, 30 May 2009 08:09:07 +0000</pubDate>
		<guid isPermaLink="false">http://thejeshgn.com/?p=403#comment-1437</guid>
		<description>Nice code snippet. But it does not work with boolean properties.
This is how you can add boolean props:
			for (int i = 0; i &lt; methods.length; i++) {
				method = methods[i];
				final String methodName = method.getName();
				final boolean isBooleanProp = methodName.startsWith(&quot;is&quot;);
				if ((methodName.startsWith(&quot;get&quot;) &#124;&#124; isBooleanProp) &amp;&amp; !method.getName().startsWith(&quot;getClass&quot;)) {
					buffer.append(method.getName().replaceAll(isBooleanProp ? &quot;is&quot; : &quot;get&quot;, &quot;&quot;));
					buffer.append(&quot; = &quot;);
					Object[] params = null;
					try {
						buffer.append(method.invoke(this, params));
					} catch (Exception e) {
						buffer.append(&quot;  &quot;);
					}
					buffer.append(lineSeaparator);
				}
			}</description>
		<content:encoded><![CDATA[<p>Nice code snippet. But it does not work with boolean properties.<br />
This is how you can add boolean props:<br />
			for (int i = 0; i &lt; methods.length; i++) {<br />
				method = methods[i];<br />
				final String methodName = method.getName();<br />
				final boolean isBooleanProp = methodName.startsWith(&#8220;is&#8221;);<br />
				if ((methodName.startsWith(&#8220;get&#8221;) || isBooleanProp) &amp;&amp; !method.getName().startsWith(&#8220;getClass&#8221;)) {<br />
					buffer.append(method.getName().replaceAll(isBooleanProp ? &#8220;is&#8221; : &#8220;get&#8221;, &#8220;&#8221;));<br />
					buffer.append(&#8221; = &#8220;);<br />
					Object[] params = null;<br />
					try {<br />
						buffer.append(method.invoke(this, params));<br />
					} catch (Exception e) {<br />
						buffer.append(&#8221;  &#8220;);<br />
					}<br />
					buffer.append(lineSeaparator);<br />
				}<br />
			}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Veerasundar</title>
		<link>http://thejeshgn.com/2008/06/24/generic-tostring-method-for-simple-java-beans/comment-page-1/#comment-774</link>
		<dc:creator>Veerasundar</dc:creator>
		<pubDate>Mon, 30 Jun 2008 06:19:08 +0000</pubDate>
		<guid isPermaLink="false">http://thejeshgn.com/?p=403#comment-774</guid>
		<description>Now I get it! :-)</description>
		<content:encoded><![CDATA[<p>Now I get it! :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thejesh GN</title>
		<link>http://thejeshgn.com/2008/06/24/generic-tostring-method-for-simple-java-beans/comment-page-1/#comment-773</link>
		<dc:creator>Thejesh GN</dc:creator>
		<pubDate>Sun, 29 Jun 2008 17:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://thejeshgn.com/?p=403#comment-773</guid>
		<description>It prints the values too. We are invoking the getter method using the reflection
method.invoke(this, params)
which returns the value.</description>
		<content:encoded><![CDATA[<p>It prints the values too. We are invoking the getter method using the reflection<br />
method.invoke(this, params)<br />
which returns the value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Veera</title>
		<link>http://thejeshgn.com/2008/06/24/generic-tostring-method-for-simple-java-beans/comment-page-1/#comment-775</link>
		<dc:creator>Veera</dc:creator>
		<pubDate>Sun, 29 Jun 2008 17:33:06 +0000</pubDate>
		<guid isPermaLink="false">http://thejeshgn.com/?p=403#comment-775</guid>
		<description>Does this method print only the variable names or variable names + values?

From the code, I think it prints only variable names. Is it correct?</description>
		<content:encoded><![CDATA[<p>Does this method print only the variable names or variable names + values?</p>
<p>From the code, I think it prints only variable names. Is it correct?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
