From febdca4fd644dea1eba3b8cf752685f37e096cf1 Mon Sep 17 00:00:00 2001 From: Steven Caswell Date: Tue, 1 Oct 2002 20:03:04 +0000 Subject: [PATCH] javadoc corrections: - changed tag to
 tag around
 code examples for better formatting - added reflection method explanation
 text

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137082 13f79535-47bb-0310-9956-ffa450edef68
---
 .../commons/lang/builder/ToStringBuilder.java | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/java/org/apache/commons/lang/builder/ToStringBuilder.java b/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
index b10de7bcb..a02d1243a 100644
--- a/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
+++ b/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
@@ -69,7 +69,7 @@
  * 
  * 

* To use this class write code as follows: - * + *

  * public class Person {
  *   String name;
  *   int age;
@@ -85,15 +85,29 @@
  *       toString();
  *   }
  * }
- * 
+ * 
* This will produce a toString of the format: * Person@7f54[name=Stephen,age=29,smoker=false] *

+ * Alternatively, there is a method that uses reflection to determine + * the fields to test. Because these fields are usually private, the method, + * reflectionToString, uses Field.setAccessible to change + * the visibility of the fields. This will fail under a security manager, + * unless the appropriate permissions are set. It is also slower than testing + * explicitly. + *

+ * A typical invocation for this method would look like: + *

+ * public String toString() {
+ *   return ToStringBuilder.reflectionToString(this);
+ * }
+ * 
+ *

* The exact format of the toString is determined by the {@link ToStringStyle} * passed into the constructor. * * @author Stephen Colebourne - * @version $Id: ToStringBuilder.java,v 1.5 2002/09/29 08:26:05 bayard Exp $ + * @version $Id: ToStringBuilder.java,v 1.6 2002/10/01 20:03:04 stevencaswell Exp $ */ public class ToStringBuilder {