You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by st...@apache.org on 2002/10/01 22:03:04 UTC

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/builder ToStringBuilder.java

stevencaswell    2002/10/01 13:03:04

  Modified:    lang/src/java/org/apache/commons/lang/builder
                        ToStringBuilder.java
  Log:
  javadoc corrections:
  - changed <code> tag to <pre> tag around code examples for better formatting
  - added reflection method explanation text
  
  Revision  Changes    Path
  1.6       +17 -3     jakarta-commons/lang/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
  
  Index: ToStringBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/builder/ToStringBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ToStringBuilder.java	29 Sep 2002 08:26:05 -0000	1.5
  +++ ToStringBuilder.java	1 Oct 2002 20:03:04 -0000	1.6
  @@ -69,7 +69,7 @@
    * </ul>
    * <p>
    * To use this class write code as follows:
  - * <code>
  + * <pre>
    * public class Person {
    *   String name;
    *   int age;
  @@ -85,9 +85,23 @@
    *       toString();
    *   }
    * }
  - * </code>
  + * </pre>
    * This will produce a toString of the format:
    * <code>Person@7f54[name=Stephen,age=29,smoker=false]</code>
  + * <p>
  + * Alternatively, there is a method that uses reflection to determine
  + * the fields to test. Because these fields are usually private, the method, 
  + * <code>reflectionToString</code>, uses <code>Field.setAccessible</code> 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.
  + * <p>
  + * A typical invocation for this method would look like:
  + * <pre>
  + * public String toString() {
  + *   return ToStringBuilder.reflectionToString(this);
  + * }
  + * </pre>
    * <p>
    * The exact format of the toString is determined by the {@link ToStringStyle}
    * passed into the constructor.
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>