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


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137080 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Caswell 2002-10-01 20:00:43 +00:00
parent 9380c2fdd6
commit 48281f8ffb

View File

@ -72,37 +72,37 @@
* code must be used in the equals method, and vice versa. * code must be used in the equals method, and vice versa.
* <p> * <p>
* Typical use for the code is as follows: * Typical use for the code is as follows:
* <code> * <pre>
* public boolean equals(Object o) { * public boolean equals(Object o) {
* if (!o instanceof MyClass) { * if (!o instanceof MyClass) {
* return false; * return false;
* } * }
* MyClass rhs = (MyClass) o; * MyClass rhs = (MyClass) o;
* return new EqualsBuilder() * return new EqualsBuilder()
* .test(field1, rhs.field1) * .append(field1, rhs.field1)
* .test(field2, rhs.field2) * .append(field2, rhs.field2)
* .test(field3, rhs.field3) * .append(field3, rhs.field3)
* .isEquals(); * .isEquals();
* } * }
* </code> * </pre>
* <p> * <p>
* Alternatively, there is a method that uses reflection to determine * Alternatively, there is a method that uses reflection to determine
* the fields to test. Because these fields are usually private, the method, * 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, * the visibility of the fields. This will fail under a security manager,
* unless the appropriate permissions are set. It is also slower than testing * unless the appropriate permissions are set. It is also slower than testing
* explicitly. * explicitly.
* <p> * <p>
* A typical invocation for this method would look like: * A typical invocation for this method would look like:
* <code> * <pre>
* public boolean equals(Object o) { * public boolean equals(Object o) {
* return EqualsBuilder.reflectionEquals(this, obj); * return EqualsBuilder.reflectionEquals(this, obj);
* } * }
* </code> * </pre>
* *
* @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a> * @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @version $Id: EqualsBuilder.java,v 1.3 2002/09/22 09:18:32 scolebourne Exp $ * @version $Id: EqualsBuilder.java,v 1.4 2002/10/01 20:00:43 stevencaswell Exp $
*/ */
public class EqualsBuilder { public class EqualsBuilder {
/** /**