Javadoc fixes

bug 21758, from Pete Gieser


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-07-21 23:30:42 +00:00
parent dbe97c09ca
commit 1f0aeca4d5
6 changed files with 208 additions and 193 deletions

View File

@ -68,8 +68,8 @@ import java.lang.reflect.Modifier;
* <code>equals()</code> and <code>hashCode()</code> are consistent can be * <code>equals()</code> and <code>hashCode()</code> are consistent can be
* difficult.</p> * difficult.</p>
* *
* <p>Two Object that compare as equals must generate the same hash code. * <p>Two Objects that compare as equals must generate the same hash code,
* But two Objects with the same hash code do not have to be equal.</p> * but two Objects with the same hash code do not have to be equal.</p>
* *
* <p>All relevant fields should be included in the calculation of equals. * <p>All relevant fields should be included in the calculation of equals.
* Derived fields may be ignored. In particular, any field used in * Derived fields may be ignored. In particular, any field used in
@ -109,8 +109,9 @@ import java.lang.reflect.Modifier;
* @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a> * @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Gary Gregory * @author Gary Gregory
* @author Pete Gieser
* @since 1.0 * @since 1.0
* @version $Id: EqualsBuilder.java,v 1.16 2003/07/20 15:49:58 scolebourne Exp $ * @version $Id: EqualsBuilder.java,v 1.17 2003/07/21 23:30:42 scolebourne Exp $
*/ */
public class EqualsBuilder { public class EqualsBuilder {
/** /**
@ -122,7 +123,7 @@ public class EqualsBuilder {
* <p>Constructor for EqualsBuilder.</p> * <p>Constructor for EqualsBuilder.</p>
* *
* <p>Starts off assuming that equals is <code>true</code>.</p> * <p>Starts off assuming that equals is <code>true</code>.</p>
* @see java.lang.Object#Object() * @see java.lang.Object#equals
*/ */
public EqualsBuilder() { public EqualsBuilder() {
super(); super();
@ -137,7 +138,7 @@ public class EqualsBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is also * a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly.</p> * not as efficient as testing explicitly.</p>
* *
* <p>Transient members will be not be tested, as they are likely derived * <p>Transient members will be not be tested, as they are likely derived
@ -159,7 +160,7 @@ public class EqualsBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is also * a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly.</p> * not as efficient as testing explicitly.</p>
* *
* <p>If the TestTransients parameter is set to <code>true</code>, transient * <p>If the TestTransients parameter is set to <code>true</code>, transient
@ -183,7 +184,7 @@ public class EqualsBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is also * a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly.</p> * not as efficient as testing explicitly.</p>
* *
* <p>If the testTransients parameter is set to <code>true</code>, transient * <p>If the testTransients parameter is set to <code>true</code>, transient
@ -305,8 +306,8 @@ public class EqualsBuilder {
* <p>Test if two <code>Object</code>s are equal using their * <p>Test if two <code>Object</code>s are equal using their
* <code>equals</code> method.</p> * <code>equals</code> method.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand object
* @param rhs - Right Hand Side * @param rhs the right hand object
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(Object lhs, Object rhs) { public EqualsBuilder append(Object lhs, Object rhs) {
@ -352,10 +353,10 @@ public class EqualsBuilder {
} }
/** /**
* <p>Test if two <code>long</code>s are equal using ==.</p> * <p>Test if two <code>long</code>s are equal.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>long</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>long</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(long lhs, long rhs) { public EqualsBuilder append(long lhs, long rhs) {
@ -367,10 +368,10 @@ public class EqualsBuilder {
} }
/** /**
* <p>Test if two <code>int</code>s are equal using ==.</p> * <p>Test if two <code>int</code>s are equal.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>int</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>int</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(int lhs, int rhs) { public EqualsBuilder append(int lhs, int rhs) {
@ -382,10 +383,10 @@ public class EqualsBuilder {
} }
/** /**
* <p>Test if two <code>short</code>s are equal using ==.</p> * <p>Test if two <code>short</code>s are equal.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>short</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>short</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(short lhs, short rhs) { public EqualsBuilder append(short lhs, short rhs) {
@ -397,10 +398,10 @@ public class EqualsBuilder {
} }
/** /**
* <p>Test if two <code>char</code>s are equal using ==.</p> * <p>Test if two <code>char</code>s are equal.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>char</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>char</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(char lhs, char rhs) { public EqualsBuilder append(char lhs, char rhs) {
@ -412,10 +413,10 @@ public class EqualsBuilder {
} }
/** /**
* <p>Test if two <code>byte</code>s are equal using ==.</p> * <p>Test if two <code>byte</code>s are equal.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>byte</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>byte</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(byte lhs, byte rhs) { public EqualsBuilder append(byte lhs, byte rhs) {
@ -435,8 +436,8 @@ public class EqualsBuilder {
* <p>It is compatible with the hash code generated by * <p>It is compatible with the hash code generated by
* <code>HashCodeBuilder</code>.</p> * <code>HashCodeBuilder</code>.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>double</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>double</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(double lhs, double rhs) { public EqualsBuilder append(double lhs, double rhs) {
@ -455,8 +456,8 @@ public class EqualsBuilder {
* <p>It is compatible with the hash code generated by * <p>It is compatible with the hash code generated by
* <code>HashCodeBuilder</code>.</p> * <code>HashCodeBuilder</code>.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>float</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>float</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(float lhs, float rhs) { public EqualsBuilder append(float lhs, float rhs) {
@ -467,10 +468,10 @@ public class EqualsBuilder {
} }
/** /**
* <p>Test if two <code>booleans</code>s are equal using ==.</p> * <p>Test if two <code>booleans</code>s are equal.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>boolean</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>boolean</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(boolean lhs, boolean rhs) { public EqualsBuilder append(boolean lhs, boolean rhs) {
@ -487,8 +488,8 @@ public class EqualsBuilder {
* <p>This also will be called for the top level of * <p>This also will be called for the top level of
* multi-dimensional, ragged, and multi-typed arrays.</p> * multi-dimensional, ragged, and multi-typed arrays.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>Object[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>Object[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(Object[] lhs, Object[] rhs) { public EqualsBuilder append(Object[] lhs, Object[] rhs) {
@ -523,8 +524,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(long, long)} is used.</p> * <p>The method {@link #append(long, long)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>long[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>long[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(long[] lhs, long[] rhs) { public EqualsBuilder append(long[] lhs, long[] rhs) {
@ -554,8 +555,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(int, int)} is used.</p> * <p>The method {@link #append(int, int)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>int[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>int[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(int[] lhs, int[] rhs) { public EqualsBuilder append(int[] lhs, int[] rhs) {
@ -585,8 +586,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(short, short)} is used.</p> * <p>The method {@link #append(short, short)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>short[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>short[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(short[] lhs, short[] rhs) { public EqualsBuilder append(short[] lhs, short[] rhs) {
@ -616,8 +617,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(char, char)} is used.</p> * <p>The method {@link #append(char, char)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>char[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>char[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(char[] lhs, char[] rhs) { public EqualsBuilder append(char[] lhs, char[] rhs) {
@ -647,8 +648,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(byte, byte)} is used.</p> * <p>The method {@link #append(byte, byte)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>byte[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>byte[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(byte[] lhs, byte[] rhs) { public EqualsBuilder append(byte[] lhs, byte[] rhs) {
@ -678,8 +679,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(double, double)} is used.</p> * <p>The method {@link #append(double, double)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>double[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>double[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(double[] lhs, double[] rhs) { public EqualsBuilder append(double[] lhs, double[] rhs) {
@ -709,8 +710,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(float, float)} is used.</p> * <p>The method {@link #append(float, float)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>float[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>float[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(float[] lhs, float[] rhs) { public EqualsBuilder append(float[] lhs, float[] rhs) {
@ -740,8 +741,8 @@ public class EqualsBuilder {
* *
* <p>The method {@link #append(boolean, boolean)} is used.</p> * <p>The method {@link #append(boolean, boolean)} is used.</p>
* *
* @param lhs - Left Hand Side * @param lhs the left hand <code>boolean[]</code>
* @param rhs - Right Hand Side * @param rhs the right hand <code>boolean[]</code>
* @return EqualsBuilder - used to chain calls. * @return EqualsBuilder - used to chain calls.
*/ */
public EqualsBuilder append(boolean[] lhs, boolean[] rhs) { public EqualsBuilder append(boolean[] lhs, boolean[] rhs) {

View File

@ -60,15 +60,15 @@ import java.lang.reflect.Modifier;
/** /**
* <p><code>HashCode</code> generation routines.</p> * <p><code>HashCode</code> generation routines.</p>
* *
* <p> This class enables a good hashcode to be built for any class. It * <p> This class enables a good <code>hashCode</code> method to be built for any class. It
* follows the rules laid out in the book * follows the rules laid out in the book
* <a href="http://java.sun.com/docs/books/effective/index.html">Effective Java</a> * <a href="http://java.sun.com/docs/books/effective/index.html">Effective Java</a>
* , by Joshua Bloch. Writing a good <code>hashCode</code> is actually quite * by Joshua Bloch. Writing a good <code>hashCode</code> method is actually quite
* difficult. This class aims to simplify the process.</p> * difficult. This class aims to simplify the process.</p>
* *
* <p>All relevant fields from the object should be included in the * <p>All relevant fields from the object should be included in the
* <code>hashCode</code>. Derived fields may be excluded. In general, any * <code>hashCode</code> method. Derived fields may be excluded. In general, any
* field used in the equals method must be used in the <code>hashCode</code> * field used in the <code>equals</code> method must be used in the <code>hashCode</code>
* method.</p> * method.</p>
* *
* <p>To use this class write code as follows:</p> * <p>To use this class write code as follows:</p>
@ -91,7 +91,8 @@ import java.lang.reflect.Modifier;
* } * }
* </pre> * </pre>
* *
* <p>If required, the superclass hashCode can be added using {@link #appendSuper}.</p> * <p>If required, the superclass <code>hashCode()</code> can be added
* using {@link #appendSuper}.</p>
* *
* <p>Alternatively, there is a method that uses reflection to determine * <p>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,
@ -109,8 +110,9 @@ import java.lang.reflect.Modifier;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Gary Gregory * @author Gary Gregory
* @author Pete Gieser
* @since 1.0 * @since 1.0
* @version $Id: HashCodeBuilder.java,v 1.15 2003/07/20 15:49:58 scolebourne Exp $ * @version $Id: HashCodeBuilder.java,v 1.16 2003/07/21 23:30:42 scolebourne Exp $
*/ */
public class HashCodeBuilder { public class HashCodeBuilder {
@ -124,7 +126,7 @@ public class HashCodeBuilder {
private int iTotal = 0; private int iTotal = 0;
/** /**
* <p>Constructor for HashCodeBuilder.</p> * <p>Constructor.</p>
* *
* <p>This constructor uses two hard coded choices for the constants * <p>This constructor uses two hard coded choices for the constants
* needed to build a <code>hashCode</code>.</p> * needed to build a <code>hashCode</code>.</p>
@ -136,7 +138,7 @@ public class HashCodeBuilder {
} }
/** /**
* <p>Constructor for <code>HashCodeBuilder</code>.</p> * <p>Constructor.</p>
* *
* <p>Two randomly chosen, non-zero, odd numbers must be passed in. * <p>Two randomly chosen, non-zero, odd numbers must be passed in.
* Ideally these should be different for each class, however this is * Ideally these should be different for each class, however this is
@ -176,7 +178,7 @@ public class HashCodeBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is * a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.</p> * also not as efficient as testing explicitly.</p>
* *
* <p>Transient members will be not be used, as they are likely derived * <p>Transient members will be not be used, as they are likely derived
@ -200,7 +202,7 @@ public class HashCodeBuilder {
* *
* <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is * a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.</p> * also not as efficient as testing explicitly.</p>
* *
* <P>If the TestTransients parameter is set to <code>true</code>, transient * <P>If the TestTransients parameter is set to <code>true</code>, transient
@ -223,7 +225,7 @@ public class HashCodeBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is * a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.</p> * also not as efficient as testing explicitly.</p>
* *
* <p>Transient members will be not be used, as they are likely derived * <p>Transient members will be not be used, as they are likely derived
@ -252,7 +254,7 @@ public class HashCodeBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is also * a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly.</p> * not as efficient as testing explicitly.</p>
* *
* <p>If the TestTransients parameter is set to <code>true</code>, transient * <p>If the TestTransients parameter is set to <code>true</code>, transient
@ -284,7 +286,7 @@ public class HashCodeBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run under * fields. This means that it will throw a security exception if run under
* a security manger, if the permissions are not set up correctly. It is also * a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly.</p> * not as efficient as testing explicitly.</p>
* *
* <p>If the TestTransients parameter is set to <code>true</code>, transient * <p>If the TestTransients parameter is set to <code>true</code>, transient
@ -492,9 +494,9 @@ public class HashCodeBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>long</code>.</p> * <p>Append a <code>hashCode</code> for a <code>boolean</code>.</p>
* *
* @param value the long to add to the <code>hashCode</code> * @param value the boolean to add to the <code>hashCode</code>
* @return this * @return this
*/ */
public HashCodeBuilder append(boolean value) { public HashCodeBuilder append(boolean value) {

View File

@ -49,8 +49,9 @@ import org.apache.commons.lang.ClassUtils;
* *
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a> * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Pete Gieser
* @since 2.0 * @since 2.0
* @version $Id: ReflectionToStringBuilder.java,v 1.6 2003/07/20 01:13:14 ggregory Exp $ * @version $Id: ReflectionToStringBuilder.java,v 1.7 2003/07/21 23:30:42 scolebourne Exp $
*/ */
public class ReflectionToStringBuilder extends ToStringBuilder { public class ReflectionToStringBuilder extends ToStringBuilder {
@ -103,7 +104,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run * fields. This means that it will throw a security exception if run
* under a security manger, if the permissions are not set up correctly. * under a security manager, if the permissions are not set up correctly.
* It is also not as efficient as testing explicitly.</p> * It is also not as efficient as testing explicitly.</p>
* *
* <p>Transient members will be not be included, as they are likely derived. * <p>Transient members will be not be included, as they are likely derived.
@ -123,7 +124,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run * fields. This means that it will throw a security exception if run
* under a security manger, if the permissions are not set up correctly. * under a security manager, if the permissions are not set up correctly.
* It is also not as efficient as testing explicitly.</p> * It is also not as efficient as testing explicitly.</p>
* *
* <p>Transient members will be not be included, as they are likely derived. * <p>Transient members will be not be included, as they are likely derived.
@ -149,7 +150,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run * fields. This means that it will throw a security exception if run
* under a security manger, if the permissions are not set up correctly. * under a security manager, if the permissions are not set up correctly.
* It is also not as efficient as testing explicitly. </p> * It is also not as efficient as testing explicitly. </p>
* *
* <p>If the <code>outputTransients</code> is <code>true</code>, * <p>If the <code>outputTransients</code> is <code>true</code>,
@ -179,7 +180,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* *
* <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
* fields. This means that it will throw a security exception if run * fields. This means that it will throw a security exception if run
* under a security manger, if the permissions are not set up correctly. * under a security manager, if the permissions are not set up correctly.
* It is also not as efficient as testing explicitly. </p> * It is also not as efficient as testing explicitly. </p>
* *
* <p>If the <code>outputTransients</code> is <code>true</code>, * <p>If the <code>outputTransients</code> is <code>true</code>,
@ -198,7 +199,8 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* @param style the style of the <code>toString</code> to create, * @param style the style of the <code>toString</code> to create,
* may be <code>null</code> * may be <code>null</code>
* @param outputTransients whether to include transient fields * @param outputTransients whether to include transient fields
* @param reflectUpToClass the superclass to reflect up to (inclusive), may be null * @param reflectUpToClass the superclass to reflect up to (inclusive),
* may be <code>null</code>
* @return the String result * @return the String result
* @throws IllegalArgumentException if the Object is <code>null</code> * @throws IllegalArgumentException if the Object is <code>null</code>
*/ */
@ -232,7 +234,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
private Class upToClass = null; private Class upToClass = null;
/** /**
* <p>Constructs a new instance.</p> * <p>Constructor.</p>
* *
* <p>This constructor outputs using the default style set with * <p>This constructor outputs using the default style set with
* <code>setDefaultStyle</code>.</p> * <code>setDefaultStyle</code>.</p>
@ -247,7 +249,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
} }
/** /**
* <p>Constructor specifying the output style.</p> * <p>Constructor.</p>
* *
* <p>If the style is <code>null</code>, the default style is used.</p> * <p>If the style is <code>null</code>, the default style is used.</p>
* *
@ -263,7 +265,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
} }
/** /**
* <p>Constructors a new instance.</p> * <p>Constructor.</p>
* *
* <p>If the style is <code>null</code>, the default style is used.</p> * <p>If the style is <code>null</code>, the default style is used.</p>
* *
@ -283,7 +285,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
} }
/** /**
* Constructs a new instance. * Constructor.
* *
* @param object the Object to build a <code>toString</code> for, * @param object the Object to build a <code>toString</code> for,
* must not be <code>null</code> * must not be <code>null</code>
@ -291,6 +293,9 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* may be <code>null</code> * may be <code>null</code>
* @param buffer the <code>StringBuffer</code> to populate, may be * @param buffer the <code>StringBuffer</code> to populate, may be
* <code>null</code> * <code>null</code>
* @param reflectUpToClass the superclass to reflect up to (inclusive),
* may be <code>null</code>
* @param outputTransients whether to include transient fields
*/ */
public ReflectionToStringBuilder( public ReflectionToStringBuilder(
Object object, Object object,
@ -324,7 +329,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
* <p>Appends the fields and values defined by the given object of the * <p>Appends the fields and values defined by the given object of the
* given Class.</p> * given Class.</p>
* *
* <p>If a cycle is detected as an objects is &quot;toString()'ed&quot;, * <p>If a cycle is detected as an object is &quot;toString()'ed&quot;,
* such an object is rendered as if <code>Object.toString()</code> * such an object is rendered as if <code>Object.toString()</code>
* had been called and not implemented by the object.</p> * had been called and not implemented by the object.</p>
* *
@ -402,7 +407,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
} }
/** /**
* <p>Returns whether or not to append transient fields.</p> * <p>Gets whether or not to append transient fields.</p>
* *
* @return Whether or not to append transient fields. * @return Whether or not to append transient fields.
*/ */
@ -424,7 +429,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
/** /**
* <p>Registers this builder's source object to avoid infinite * <p>Registers this builder's source object to avoid infinite
* loops processing circular object references.</p> * loops when processing circular object references.</p>
*/ */
void registerObject() { void registerObject() {
register(this.getObject()); register(this.getObject());
@ -448,6 +453,11 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
this.upToClass = clazz; this.upToClass = clazz;
} }
/**
* Gets the String built by this builder.
*
* @return the built string
*/
public String toString() { public String toString() {
if (this.getObject() == null) { if (this.getObject() == null) {
return this.getStyle().getNullText(); return this.getStyle().getNullText();
@ -463,7 +473,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
/** /**
* <p>Unegisters this builder's source object to avoid infinite * <p>Unegisters this builder's source object to avoid infinite
* loops processing circular object references.</p> * loops when processing circular object references.</p>
*/ */
void unregisterObject() { void unregisterObject() {
unregister(this.getObject()); unregister(this.getObject());

View File

@ -64,8 +64,9 @@ package org.apache.commons.lang.builder;
* program to access.</p> * program to access.</p>
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Pete Gieser
* @since 1.0 * @since 1.0
* @version $Id: StandardToStringStyle.java,v 1.9 2003/07/14 22:25:03 bayard Exp $ * @version $Id: StandardToStringStyle.java,v 1.10 2003/07/21 23:30:42 scolebourne Exp $
*/ */
public class StandardToStringStyle extends ToStringStyle { public class StandardToStringStyle extends ToStringStyle {
@ -211,8 +212,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the array start text.</p> * <p>Sets the array start text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empry String.</p> * to an empty String.</p>
* *
* @param arrayStart the new array start text * @param arrayStart the new array start text
*/ */
@ -234,8 +235,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the array end text.</p> * <p>Sets the array end text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param arrayEnd the new array end text * @param arrayEnd the new array end text
*/ */
@ -257,8 +258,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the array separator text.</p> * <p>Sets the array separator text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param arraySeparator the new array separator text * @param arraySeparator the new array separator text
*/ */
@ -280,8 +281,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the content start text.</p> * <p>Sets the content start text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param contentStart the new content start text * @param contentStart the new content start text
*/ */
@ -303,8 +304,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the content end text.</p> * <p>Sets the content end text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param contentEnd the new content end text * @param contentEnd the new content end text
*/ */
@ -326,8 +327,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the field name value separator text.</p> * <p>Sets the field name value separator text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param fieldNameValueSeparator the new field name value separator text * @param fieldNameValueSeparator the new field name value separator text
*/ */
@ -349,8 +350,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the field separator text.</p> * <p>Sets the field separator text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param fieldSeparator the new field separator text * @param fieldSeparator the new field separator text
*/ */
@ -416,8 +417,8 @@ public class StandardToStringStyle extends ToStringStyle {
/** /**
* <p>Sets the text to output when <code>null</code> found.</p> * <p>Sets the text to output when <code>null</code> found.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a empty String.</p> * to an empty String.</p>
* *
* @param nullText the new text to output when <code>null</code> found * @param nullText the new text to output when <code>null</code> found
*/ */
@ -440,13 +441,13 @@ public class StandardToStringStyle extends ToStringStyle {
} }
/** /**
* <p>Sets the text to output when a <code>Collection</code>, * <p>Sets the start text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p> * <code>Map</code> or <code>Array</code> size is output.</p>
* *
* <p>This is output before the size value.</p> * <p>This is output before the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param sizeStartText the new start of size text * @param sizeStartText the new start of size text
*/ */
@ -457,7 +458,7 @@ public class StandardToStringStyle extends ToStringStyle {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* Gets the text to output when a <code>Collection</code>, * Gets the end text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p> * <code>Map</code> or <code>Array</code> size is output.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
@ -469,13 +470,13 @@ public class StandardToStringStyle extends ToStringStyle {
} }
/** /**
* <p>Sets the text to output when a <code>Collection</code>, * <p>Sets the end text to output when a <code>Collection</code>,
* <code>Map</code> or <code>Array</code> size is output.</p> * <code>Map</code> or <code>Array</code> size is output.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted * <p><code>null</code> is accepted, but will be converted
* to a Empty String.</p> * to an empty String.</p>
* *
* @param sizeEndText the new end of size text * @param sizeEndText the new end of size text
*/ */
@ -486,7 +487,7 @@ public class StandardToStringStyle extends ToStringStyle {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* <p>Gets the text to output when an <code>Object</code> is * <p>Gets the start text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <P>This is output before the size value.</p> * <P>This is output before the size value.</p>
@ -498,13 +499,13 @@ public class StandardToStringStyle extends ToStringStyle {
} }
/** /**
* <p>Sets the text to output when an <code>Object</code> is * <p>Sets the start text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output before the size value.</p> * <p>This is output before the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param summaryObjectStartText the new start of summary text * @param summaryObjectStartText the new start of summary text
*/ */
@ -515,7 +516,7 @@ public class StandardToStringStyle extends ToStringStyle {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* <p>Gets the text to output when an <code>Object</code> is * <p>Gets the end text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
@ -527,13 +528,13 @@ public class StandardToStringStyle extends ToStringStyle {
} }
/** /**
* <p>Sets the text to output when an <code>Object</code> is * <p>Sets the end text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param summaryObjectEndText the new end of summary text * @param summaryObjectEndText the new end of summary text
*/ */

View File

@ -57,7 +57,7 @@ import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
/** /**
* <p>Builds <code>toString()</code> values.</p> * <p><code>ToString</code> generation routines.</p>
* *
* <p>This class enables a good and consistent <code>toString()</code> to be built for any * <p>This class enables a good and consistent <code>toString()</code> to be built for any
* class or object. This class aims to simplify the process by:</p> * class or object. This class aims to simplify the process by:</p>
@ -99,7 +99,7 @@ import org.apache.commons.lang.ObjectUtils;
* *
* <p>Alternatively, there is a method that uses reflection to determine * <p>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>reflectionToString</code>, uses <code>Field.setAccessible</code> to * <code>reflectionToString</code>, uses <code>AccessibleObject.setAccessible</code> to
* change the visibility of the fields. This will fail under a security manager, * change the visibility of the fields. This will fail under a security manager,
* unless the appropriate permissions are set up correctly. It is also * unless the appropriate permissions are set up correctly. It is also
* slower than testing explicitly.</p> * slower than testing explicitly.</p>
@ -123,8 +123,9 @@ import org.apache.commons.lang.ObjectUtils;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Gary Gregory * @author Gary Gregory
* @author Pete Gieser
* @since 1.0 * @since 1.0
* @version $Id: ToStringBuilder.java,v 1.25 2003/07/16 01:47:39 ggregory Exp $ * @version $Id: ToStringBuilder.java,v 1.26 2003/07/21 23:30:41 scolebourne Exp $
*/ */
public class ToStringBuilder { public class ToStringBuilder {
@ -288,7 +289,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> an <code>boolean</code> * <p>Append to the <code>toString</code> a <code>boolean</code>
* value.</p> * value.</p>
* *
* @param value the value to add to the <code>toString</code> * @param value the value to add to the <code>toString</code>
@ -316,7 +317,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> an <code>byte</code> * <p>Append to the <code>toString</code> a <code>byte</code>
* value.</p> * value.</p>
* *
* @param value the value to add to the <code>toString</code> * @param value the value to add to the <code>toString</code>
@ -344,7 +345,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> an <code>char</code> * <p>Append to the <code>toString</code> a <code>char</code>
* value.</p> * value.</p>
* *
* @param value the value to add to the <code>toString</code> * @param value the value to add to the <code>toString</code>
@ -372,7 +373,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> an <code>double</code> * <p>Append to the <code>toString</code> a <code>double</code>
* value.</p> * value.</p>
* *
* @param value the value to add to the <code>toString</code> * @param value the value to add to the <code>toString</code>
@ -400,7 +401,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> an <code>float</code> * <p>Append to the <code>toString</code> a <code>float</code>
* value.</p> * value.</p>
* *
* @param value the value to add to the <code>toString</code> * @param value the value to add to the <code>toString</code>
@ -442,7 +443,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> a <code>int</code> * <p>Append to the <code>toString</code> an <code>int</code>
* array.</p> * array.</p>
* *
* @param array the array to add to the <code>toString</code> * @param array the array to add to the <code>toString</code>
@ -512,7 +513,7 @@ public class ToStringBuilder {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append to the <code>toString</code> an <code>short</code> * <p>Append to the <code>toString</code> a <code>short</code>
* value.</p> * value.</p>
* *
* @param value the value to add to the <code>toString</code> * @param value the value to add to the <code>toString</code>
@ -538,7 +539,7 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append to the <code>toString</code> an <code>boolean</code> * <p>Append to the <code>toString</code> a <code>boolean</code>
* value.</p> * value.</p>
* *
* @param fieldName the field name * @param fieldName the field name
@ -551,7 +552,7 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>boolean</code> * <p>Append to the <code>toString</code> a <code>boolean</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
@ -597,11 +598,10 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>byte</code> * <p>Append to the <code>toString</code> a <code>byte</code> array.</p>
* array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, byte[] array) { public ToStringBuilder append(String fieldName, byte[] array) {
@ -630,7 +630,7 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append to the <code>toString</code> an <code>char</code> * <p>Append to the <code>toString</code> a <code>char</code>
* value.</p> * value.</p>
* *
* @param fieldName the field name * @param fieldName the field name
@ -643,11 +643,11 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>char</code> * <p>Append to the <code>toString</code> a <code>char</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, char[] array) { public ToStringBuilder append(String fieldName, char[] array) {
@ -676,7 +676,7 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append to the <code>toString</code> an <code>double</code> * <p>Append to the <code>toString</code> a <code>double</code>
* value.</p> * value.</p>
* *
* @param fieldName the field name * @param fieldName the field name
@ -689,11 +689,11 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>double</code> * <p>Append to the <code>toString</code> a <code>double</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, double[] array) { public ToStringBuilder append(String fieldName, double[] array) {
@ -735,11 +735,11 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>float</code> * <p>Append to the <code>toString</code> a <code>float</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, float[] array) { public ToStringBuilder append(String fieldName, float[] array) {
@ -781,11 +781,11 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for an <code>int</code> * <p>Append to the <code>toString</code> an <code>int</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, int[] array) { public ToStringBuilder append(String fieldName, int[] array) {
@ -827,11 +827,11 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>long</code> * <p>Append to the <code>toString</code> a <code>long</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, long[] array) { public ToStringBuilder append(String fieldName, long[] array) {
@ -934,11 +934,11 @@ public class ToStringBuilder {
} }
/** /**
* <p>Append a <code>hashCode</code> for a <code>short</code> * <p>Append to the <code>toString</code> a <code>short</code>
* array.</p> * array.</p>
* *
* @param fieldName the field name * @param fieldName the field name
* @param array the array to add to the <code>hashCode</code> * @param array the array to add to the <code>toString</code>
* @return this * @return this
*/ */
public ToStringBuilder append(String fieldName, short[] array) { public ToStringBuilder append(String fieldName, short[] array) {
@ -983,10 +983,10 @@ public class ToStringBuilder {
/** /**
* <p>Append the <code>toString</code> from the superclass.</p> * <p>Append the <code>toString</code> from the superclass.</p>
* *
* <p>This method asumes that the superclass uses the same <code>ToStringStyle</code> * <p>This method assumes that the superclass uses the same <code>ToStringStyle</code>
* as this one.</p> * as this one.</p>
* *
* <p>If the <code>superToString</code> is null, no change is made.</p> * <p>If <code>superToString</code> is <code>null</code>, no change is made.</p>
* *
* @param superToString the result of <code>super.toString()</code> * @param superToString the result of <code>super.toString()</code>
* @return this * @return this
@ -1002,7 +1002,7 @@ public class ToStringBuilder {
* <p>Append the <code>toString</code> from another object.</p> * <p>Append the <code>toString</code> from another object.</p>
* *
* <p>This method is useful where a class delegates most of the implementation of * <p>This method is useful where a class delegates most of the implementation of
* it's properties to another class. You can then call <code>toString()</code> on * its properties to another class. You can then call <code>toString()</code> on
* the other class and pass the result into this method.</p> * the other class and pass the result into this method.</p>
* *
* <pre> * <pre>
@ -1016,7 +1016,7 @@ public class ToStringBuilder {
* toString(); * toString();
* }</pre> * }</pre>
* *
* <p>This method asumes that the other object uses the same <code>ToStringStyle</code> * <p>This method assumes that the other object uses the same <code>ToStringStyle</code>
* as this one.</p> * as this one.</p>
* *
* <p>If the <code>toString</code> is <code>null</code>, no change is made.</p> * <p>If the <code>toString</code> is <code>null</code>, no change is made.</p>
@ -1054,7 +1054,7 @@ public class ToStringBuilder {
/** /**
* <p>Returns the built <code>toString</code>.</p> * <p>Returns the built <code>toString</code>.</p>
* *
* <p>This method appends the end of the buffer, and can only be called once. * <p>This method appends the end of data indicator, and can only be called once.
* Use {@link #getStringBuffer} to get the current string state.</p> * Use {@link #getStringBuffer} to get the current string state.</p>
* *
* @return the String <code>toString</code> * @return the String <code>toString</code>

View File

@ -84,8 +84,9 @@ import org.apache.commons.lang.SystemUtils;
* *
* @author Stephen Colebourne * @author Stephen Colebourne
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a> * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Pete Gieser
* @since 1.0 * @since 1.0
* @version $Id: ToStringStyle.java,v 1.19 2003/07/21 23:03:53 scolebourne Exp $ * @version $Id: ToStringStyle.java,v 1.20 2003/07/21 23:30:42 scolebourne Exp $
*/ */
public abstract class ToStringStyle implements Serializable { public abstract class ToStringStyle implements Serializable {
@ -201,9 +202,9 @@ public abstract class ToStringStyle implements Serializable {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append the superclass toString.</p> * <p>Append to the <code>toString</code> the superclass toString.</p>
* *
* <p>A <code>null</code> <code>super.toString()</code> is ignored.</p> * <p>A <code>null</code> <code>superToString</code> is ignored.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param superToString the <code>super.toString()</code> * @param superToString the <code>super.toString()</code>
@ -213,12 +214,12 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append a toString.</p> * <p>Append to the <code>toString</code> another toString.</p>
* *
* <p>A <code>null</code> <code>toString()</code> is ignored.</p> * <p>A <code>null</code> <code>toString</code> is ignored.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param toString the <code>super.toString()</code> * @param toString the additional <code>toString</code>
*/ */
public void appendToString(StringBuffer buffer, String toString) { public void appendToString(StringBuffer buffer, String toString) {
if (toString != null) { if (toString != null) {
@ -236,7 +237,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the start of data indicator.</p> * <p>Append to the <code>toString</code> the start of data indicator.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param object the <code>Object</code> to build a * @param object the <code>Object</code> to build a
@ -252,7 +253,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the end of data indicator.</p> * <p>Append to the <code>toString</code> the end of data indicator.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param object the <code>Object</code> to build a * @param object the <code>Object</code> to build a
@ -315,7 +316,7 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Append to the <code>toString</code> an <code>Object</code>, * <p>Append to the <code>toString</code> an <code>Object</code>,
* correctly interpretting its type.</p> * correctly interpreting its type.</p>
* *
* <p>This method performs the main lookup by Class type to correctly * <p>This method performs the main lookup by Class type to correctly
* route arrays, <code>Collections</code>, <code>Maps</code> and * route arrays, <code>Collections</code>, <code>Maps</code> and
@ -754,7 +755,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append to the <code>toString</code> the detail of an any array type.</p> * <p>Append to the <code>toString</code> the detail of an array type.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param fieldName the field name, typically not used as already appended * @param fieldName the field name, typically not used as already appended
@ -1283,7 +1284,7 @@ public abstract class ToStringStyle implements Serializable {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* <p>Append the class name.</p> * <p>Append to the <code>toString</code> the class name.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param object the <code>Object</code> whose name to output * @param object the <code>Object</code> whose name to output
@ -1312,7 +1313,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the content start to the buffer.</p> * <p>Append to the <code>toString</code> the content start.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
*/ */
@ -1321,7 +1322,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the content end to the buffer.</p> * <p>Append to the <code>toString</code> the content end.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
*/ */
@ -1330,7 +1331,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append an indicator for <code>null</code> to the buffer.</p> * <p>Append to the <code>toString</code> an indicator for <code>null</code>.</p>
* *
* <p>The default indicator is <code>'&lt;null&gt;'</code>.</p> * <p>The default indicator is <code>'&lt;null&gt;'</code>.</p>
* *
@ -1342,7 +1343,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the field separator to the buffer.</p> * <p>Append to the <code>toString</code> the field separator.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
*/ */
@ -1351,7 +1352,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the field start to the buffer.</p> * <p>Append to the <code>toString</code> the field start.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param fieldName the field name * @param fieldName the field name
@ -1364,7 +1365,7 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Append the field end to the buffer.</p> * <p>Append to the <code>toString<code> the field end.</p>
* *
* @param buffer the <code>StringBuffer</code> to populate * @param buffer the <code>StringBuffer</code> to populate
* @param fieldName the field name, typically not used as already appended * @param fieldName the field name, typically not used as already appended
@ -1572,8 +1573,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the array start text.</p> * <p>Sets the array start text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a emptry String.</p> * an empty String.</p>
* *
* @param arrayStart the new array start text * @param arrayStart the new array start text
*/ */
@ -1598,8 +1599,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the array end text.</p> * <p>Sets the array end text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param arrayEnd the new array end text * @param arrayEnd the new array end text
*/ */
@ -1624,8 +1625,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the array separator text.</p> * <p>Sets the array separator text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param arraySeparator the new array separator text * @param arraySeparator the new array separator text
*/ */
@ -1650,8 +1651,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the content start text.</p> * <p>Sets the content start text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param contentStart the new content start text * @param contentStart the new content start text
*/ */
@ -1676,8 +1677,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the content end text.</p> * <p>Sets the content end text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param contentEnd the new content end text * @param contentEnd the new content end text
*/ */
@ -1702,8 +1703,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the field name value separator text.</p> * <p>Sets the field name value separator text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param fieldNameValueSeparator the new field name value separator text * @param fieldNameValueSeparator the new field name value separator text
*/ */
@ -1728,8 +1729,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the field separator text.</p> * <p>Sets the field separator text.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param fieldSeparator the new field separator text * @param fieldSeparator the new field separator text
*/ */
@ -1798,8 +1799,8 @@ public abstract class ToStringStyle implements Serializable {
/** /**
* <p>Sets the text to output when <code>null</code> found.</p> * <p>Sets the text to output when <code>null</code> found.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param nullText the new text to output when null found * @param nullText the new text to output when null found
*/ */
@ -1813,7 +1814,7 @@ public abstract class ToStringStyle implements Serializable {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* <p>Gets the text to output when a <code>Collection</code>, * <p>Gets the start text to output when a <code>Collection</code>,
* <code>Map</code> or array size is output.</p> * <code>Map</code> or array size is output.</p>
* *
* <p>This is output before the size value.</p> * <p>This is output before the size value.</p>
@ -1825,13 +1826,13 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Sets the text to output when a <code>Collection</code>, * <p>Sets the start text to output when a <code>Collection</code>,
* <code>Map</code> or array size is output.</p> * <code>Map</code> or array size is output.</p>
* *
* <p>This is output before the size value.</p> * <p>This is output before the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param sizeStartText the new start of size text * @param sizeStartText the new start of size text
*/ */
@ -1845,7 +1846,7 @@ public abstract class ToStringStyle implements Serializable {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* <p>Gets the text to output when a <code>Collection</code>, * <p>Gets the end text to output when a <code>Collection</code>,
* <code>Map</code> or array size is output.</p> * <code>Map</code> or array size is output.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
@ -1857,13 +1858,13 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Sets the text to output when a <code>Collection</code>, * <p>Sets the end text to output when a <code>Collection</code>,
* <code>Map</code> or array size is output.</p> * <code>Map</code> or array size is output.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param sizeEndText the new end of size text * @param sizeEndText the new end of size text
*/ */
@ -1877,7 +1878,7 @@ public abstract class ToStringStyle implements Serializable {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* <p>Gets the text to output when an <code>Object</code> is * <p>Gets the start text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output before the size value.</p> * <p>This is output before the size value.</p>
@ -1889,13 +1890,13 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Sets the text to output when an <code>Object</code> is * <p>Sets the start text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output before the size value.</p> * <p>This is output before the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param summaryObjectStartText the new start of summary text * @param summaryObjectStartText the new start of summary text
*/ */
@ -1909,7 +1910,7 @@ public abstract class ToStringStyle implements Serializable {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
/** /**
* <p>Gets the text to output when an <code>Object</code> is * <p>Gets the end text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
@ -1921,13 +1922,13 @@ public abstract class ToStringStyle implements Serializable {
} }
/** /**
* <p>Sets the text to output when an <code>Object</code> is * <p>Sets the end text to output when an <code>Object</code> is
* output in summary mode.</p> * output in summary mode.</p>
* *
* <p>This is output after the size value.</p> * <p>This is output after the size value.</p>
* *
* <p><code>Null</code> is accepted, but will be converted to * <p><code>null</code> is accepted, but will be converted to
* a empty String.</p> * an empty String.</p>
* *
* @param summaryObjectEndText the new end of summary text * @param summaryObjectEndText the new end of summary text
*/ */