commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/builder EqualsBuilder.java
Date Thu, 03 Oct 2002 05:15:56 GMT
I like to use the following for formatting code examples in
JavaDoc/HTML:

<blockquote><code><pre>
  ...
</pre></code></blockquote>

stevencaswell@apache.org writes:

> stevencaswell    2002/10/01 13:00:43
> 
>   Modified:    lang/src/java/org/apache/commons/lang/builder
>                         EqualsBuilder.java
>   Log:
>   javadoc corrections:
>   - corrected name of append method in code example
>   - changed <code> tag to <pre> tag around code examples for better formatting
>   - corrected reflection method name in explanation text
>   
>   Revision  Changes    Path
>   1.4       +9 -9      jakarta-commons/lang/src/java/org/apache/commons/lang/builder/EqualsBuilder.java
>   
>   Index: EqualsBuilder.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/builder/EqualsBuilder.java,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- EqualsBuilder.java	22 Sep 2002 09:18:32 -0000	1.3
>   +++ EqualsBuilder.java	1 Oct 2002 20:00:43 -0000	1.4
>   @@ -72,33 +72,33 @@
>     * code must be used in the equals method, and vice versa.
>     * <p>
>     * Typical use for the code is as follows:
>   - * <code>
>   + * <pre>
>     * public boolean equals(Object o) {
>     *   if (!o instanceof MyClass) {
>     *    return false;
>     *   }
>     *  MyClass rhs = (MyClass) o;
>     *  return new EqualsBuilder()
>   - *                 .test(field1, rhs.field1)
>   - *                 .test(field2, rhs.field2)
>   - *                 .test(field3, rhs.field3)
>   + *                 .append(field1, rhs.field1)
>   + *                 .append(field2, rhs.field2)
>   + *                 .append(field3, rhs.field3)
>     *                 .isEquals();
>     *  }
>   - * </code>
>   + * </pre>
>     * <p>
>     * Alternatively, there is a method that uses reflection to determine
>     * the fields to test. Because these fields are usually private, the method, 
>   - * <code>reflectionTest</code>, uses <code>Field.setAccessible</code>
to change
>   + * <code>reflectionEquals</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:
>   - * <code>
>   + * <pre>
>     * public boolean equals(Object o) {
>     *   return EqualsBuilder.reflectionEquals(this, obj);
>     * }
>   - * </code>
>   + * </pre>
>     * 
>     * @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
>     * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
>   
>   
>   
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 

-- 

Daniel Rall <dlr@finemaltcoding.com>

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message