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 @@
* <code>equals()</code> and <code>hashCode()</code> are consistent can be
* difficult.</p>
*
* <p>Two Object 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>
* <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>
*
* <p>All relevant fields should be included in the calculation of equals.
* Derived fields may be ignored. In particular, any field used in
@ -109,8 +109,9 @@
* @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
* @author Stephen Colebourne
* @author Gary Gregory
* @author Pete Gieser
* @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 {
/**
@ -122,7 +123,7 @@ public class EqualsBuilder {
* <p>Constructor for EqualsBuilder.</p>
*
* <p>Starts off assuming that equals is <code>true</code>.</p>
* @see java.lang.Object#Object()
* @see java.lang.Object#equals
*/
public EqualsBuilder() {
super();
@ -137,7 +138,7 @@ public EqualsBuilder() {
*
* <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
* 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>
*
* <p>Transient members will be not be tested, as they are likely derived
@ -159,7 +160,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs) {
*
* <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
* 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>
*
* <p>If the TestTransients parameter is set to <code>true</code>, transient
@ -183,7 +184,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans
*
* <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
* 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>
*
* <p>If the testTransients parameter is set to <code>true</code>, transient
@ -305,8 +306,8 @@ public EqualsBuilder appendSuper(boolean superEquals) {
* <p>Test if two <code>Object</code>s are equal using their
* <code>equals</code> method.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand object
* @param rhs the right hand object
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(Object lhs, Object rhs) {
@ -352,10 +353,10 @@ public EqualsBuilder append(Object lhs, Object rhs) {
}
/**
* <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 rhs - Right Hand Side
* @param lhs the left hand <code>long</code>
* @param rhs the right hand <code>long</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(long lhs, long rhs) {
@ -367,10 +368,10 @@ public EqualsBuilder append(long lhs, long rhs) {
}
/**
* <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 rhs - Right Hand Side
* @param lhs the left hand <code>int</code>
* @param rhs the right hand <code>int</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(int lhs, int rhs) {
@ -382,10 +383,10 @@ public EqualsBuilder append(int lhs, int rhs) {
}
/**
* <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 rhs - Right Hand Side
* @param lhs the left hand <code>short</code>
* @param rhs the right hand <code>short</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(short lhs, short rhs) {
@ -397,10 +398,10 @@ public EqualsBuilder append(short lhs, short rhs) {
}
/**
* <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 rhs - Right Hand Side
* @param lhs the left hand <code>char</code>
* @param rhs the right hand <code>char</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(char lhs, char rhs) {
@ -412,10 +413,10 @@ public EqualsBuilder append(char lhs, char rhs) {
}
/**
* <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 rhs - Right Hand Side
* @param lhs the left hand <code>byte</code>
* @param rhs the right hand <code>byte</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(byte lhs, byte rhs) {
@ -435,8 +436,8 @@ public EqualsBuilder append(byte lhs, byte rhs) {
* <p>It is compatible with the hash code generated by
* <code>HashCodeBuilder</code>.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>double</code>
* @param rhs the right hand <code>double</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(double lhs, double rhs) {
@ -455,8 +456,8 @@ public EqualsBuilder append(double lhs, double rhs) {
* <p>It is compatible with the hash code generated by
* <code>HashCodeBuilder</code>.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>float</code>
* @param rhs the right hand <code>float</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(float lhs, float rhs) {
@ -467,10 +468,10 @@ public EqualsBuilder append(float lhs, float rhs) {
}
/**
* <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 rhs - Right Hand Side
* @param lhs the left hand <code>boolean</code>
* @param rhs the right hand <code>boolean</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(boolean lhs, boolean rhs) {
@ -487,8 +488,8 @@ public EqualsBuilder append(boolean lhs, boolean rhs) {
* <p>This also will be called for the top level of
* multi-dimensional, ragged, and multi-typed arrays.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>Object[]</code>
* @param rhs the right hand <code>Object[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(Object[] lhs, Object[] rhs) {
@ -523,8 +524,8 @@ public EqualsBuilder append(Object[] lhs, Object[] rhs) {
*
* <p>The method {@link #append(long, long)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>long[]</code>
* @param rhs the right hand <code>long[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(long[] lhs, long[] rhs) {
@ -554,8 +555,8 @@ public EqualsBuilder append(long[] lhs, long[] rhs) {
*
* <p>The method {@link #append(int, int)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>int[]</code>
* @param rhs the right hand <code>int[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(int[] lhs, int[] rhs) {
@ -585,8 +586,8 @@ public EqualsBuilder append(int[] lhs, int[] rhs) {
*
* <p>The method {@link #append(short, short)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>short[]</code>
* @param rhs the right hand <code>short[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(short[] lhs, short[] rhs) {
@ -616,8 +617,8 @@ public EqualsBuilder append(short[] lhs, short[] rhs) {
*
* <p>The method {@link #append(char, char)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>char[]</code>
* @param rhs the right hand <code>char[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(char[] lhs, char[] rhs) {
@ -647,8 +648,8 @@ public EqualsBuilder append(char[] lhs, char[] rhs) {
*
* <p>The method {@link #append(byte, byte)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>byte[]</code>
* @param rhs the right hand <code>byte[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(byte[] lhs, byte[] rhs) {
@ -678,8 +679,8 @@ public EqualsBuilder append(byte[] lhs, byte[] rhs) {
*
* <p>The method {@link #append(double, double)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>double[]</code>
* @param rhs the right hand <code>double[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(double[] lhs, double[] rhs) {
@ -709,8 +710,8 @@ public EqualsBuilder append(double[] lhs, double[] rhs) {
*
* <p>The method {@link #append(float, float)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>float[]</code>
* @param rhs the right hand <code>float[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(float[] lhs, float[] rhs) {
@ -740,8 +741,8 @@ public EqualsBuilder append(float[] lhs, float[] rhs) {
*
* <p>The method {@link #append(boolean, boolean)} is used.</p>
*
* @param lhs - Left Hand Side
* @param rhs - Right Hand Side
* @param lhs the left hand <code>boolean[]</code>
* @param rhs the right hand <code>boolean[]</code>
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(boolean[] lhs, boolean[] rhs) {

View File

@ -60,15 +60,15 @@
/**
* <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
* <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>
*
* <p>All relevant fields from the object should be included in the
* <code>hashCode</code>. Derived fields may be excluded. In general, any
* field used in the equals method must be used in the <code>hashCode</code>
* <code>hashCode</code> method. Derived fields may be excluded. In general, any
* field used in the <code>equals</code> method must be used in the <code>hashCode</code>
* method.</p>
*
* <p>To use this class write code as follows:</p>
@ -91,7 +91,8 @@
* }
* </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
* the fields to test. Because these fields are usually private, the method,
@ -109,8 +110,9 @@
*
* @author Stephen Colebourne
* @author Gary Gregory
* @author Pete Gieser
* @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 {
@ -124,7 +126,7 @@ public class HashCodeBuilder {
private int iTotal = 0;
/**
* <p>Constructor for HashCodeBuilder.</p>
* <p>Constructor.</p>
*
* <p>This constructor uses two hard coded choices for the constants
* needed to build a <code>hashCode</code>.</p>
@ -136,7 +138,7 @@ public HashCodeBuilder() {
}
/**
* <p>Constructor for <code>HashCodeBuilder</code>.</p>
* <p>Constructor.</p>
*
* <p>Two randomly chosen, non-zero, odd numbers must be passed in.
* Ideally these should be different for each class, however this is
@ -176,7 +178,7 @@ public HashCodeBuilder(int initialNonZeroOddNumber, int multiplierNonZeroOddNumb
*
* <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
* 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>
*
* <p>Transient members will be not be used, as they are likely derived
@ -200,7 +202,7 @@ public static int reflectionHashCode(Object object) {
*
* <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
* 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>
*
* <P>If the TestTransients parameter is set to <code>true</code>, transient
@ -223,7 +225,7 @@ public static int reflectionHashCode(Object object, boolean testTransients) {
*
* <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
* 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>
*
* <p>Transient members will be not be used, as they are likely derived
@ -252,7 +254,7 @@ public static int reflectionHashCode(
*
* <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
* 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>
*
* <p>If the TestTransients parameter is set to <code>true</code>, transient
@ -284,7 +286,7 @@ public static int reflectionHashCode(
*
* <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
* 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>
*
* <p>If the TestTransients parameter is set to <code>true</code>, transient
@ -492,9 +494,9 @@ public HashCodeBuilder append(float value) {
}
/**
* <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
*/
public HashCodeBuilder append(boolean value) {

View File

@ -49,8 +49,9 @@
*
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Stephen Colebourne
* @author Pete Gieser
* @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 {
@ -103,7 +104,7 @@ static void register(Object value) {
*
* <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 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>
*
* <p>Transient members will be not be included, as they are likely derived.
@ -123,7 +124,7 @@ public static String toString(Object object) {
*
* <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 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>
*
* <p>Transient members will be not be included, as they are likely derived.
@ -149,7 +150,7 @@ public static String toString(Object object, ToStringStyle style) {
*
* <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 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>
*
* <p>If the <code>outputTransients</code> is <code>true</code>,
@ -179,7 +180,7 @@ public static String toString(Object object, ToStringStyle style, boolean output
*
* <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 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>
*
* <p>If the <code>outputTransients</code> is <code>true</code>,
@ -198,7 +199,8 @@ public static String toString(Object object, ToStringStyle style, boolean output
* @param style the style of the <code>toString</code> to create,
* may be <code>null</code>
* @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
* @throws IllegalArgumentException if the Object is <code>null</code>
*/
@ -232,7 +234,7 @@ static void unregister(Object value) {
private Class upToClass = null;
/**
* <p>Constructs a new instance.</p>
* <p>Constructor.</p>
*
* <p>This constructor outputs using the default style set with
* <code>setDefaultStyle</code>.</p>
@ -247,7 +249,7 @@ public ReflectionToStringBuilder(Object object) {
}
/**
* <p>Constructor specifying the output style.</p>
* <p>Constructor.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
@ -263,7 +265,7 @@ public ReflectionToStringBuilder(Object object, ToStringStyle style) {
}
/**
* <p>Constructors a new instance.</p>
* <p>Constructor.</p>
*
* <p>If the style is <code>null</code>, the default style is used.</p>
*
@ -283,7 +285,7 @@ public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffe
}
/**
* Constructs a new instance.
* Constructor.
*
* @param object the Object to build a <code>toString</code> for,
* must not be <code>null</code>
@ -291,6 +293,9 @@ public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffe
* may be <code>null</code>
* @param buffer the <code>StringBuffer</code> to populate, may be
* <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(
Object object,
@ -324,7 +329,7 @@ protected boolean accept(Field field) {
* <p>Appends the fields and values defined by the given object of the
* 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>
* had been called and not implemented by the object.</p>
*
@ -402,7 +407,7 @@ protected Object getValue(Field field) throws IllegalArgumentException, IllegalA
}
/**
* <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.
*/
@ -424,7 +429,7 @@ public ToStringBuilder reflectionAppendArray(Object array) {
/**
* <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() {
register(this.getObject());
@ -448,6 +453,11 @@ public void setUpToClass(Class clazz) {
this.upToClass = clazz;
}
/**
* Gets the String built by this builder.
*
* @return the built string
*/
public String toString() {
if (this.getObject() == null) {
return this.getStyle().getNullText();
@ -463,7 +473,7 @@ public String toString() {
/**
* <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() {
unregister(this.getObject());

View File

@ -64,8 +64,9 @@
* program to access.</p>
*
* @author Stephen Colebourne
* @author Pete Gieser
* @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 {
@ -211,8 +212,8 @@ public String getArrayStart() {
/**
* <p>Sets the array start text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empry String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param arrayStart the new array start text
*/
@ -234,8 +235,8 @@ public String getArrayEnd() {
/**
* <p>Sets the array end text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param arrayEnd the new array end text
*/
@ -257,8 +258,8 @@ public String getArraySeparator() {
/**
* <p>Sets the array separator text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param arraySeparator the new array separator text
*/
@ -280,8 +281,8 @@ public String getContentStart() {
/**
* <p>Sets the content start text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param contentStart the new content start text
*/
@ -303,8 +304,8 @@ public String getContentEnd() {
/**
* <p>Sets the content end text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param contentEnd the new content end text
*/
@ -326,8 +327,8 @@ public String getFieldNameValueSeparator() {
/**
* <p>Sets the field name value separator text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param fieldNameValueSeparator the new field name value separator text
*/
@ -349,8 +350,8 @@ public String getFieldSeparator() {
/**
* <p>Sets the field separator text.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param fieldSeparator the new field separator text
*/
@ -416,8 +417,8 @@ public String getNullText() {
/**
* <p>Sets the text to output when <code>null</code> found.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param nullText the new text to output when <code>null</code> found
*/
@ -440,13 +441,13 @@ public String getSizeStartText() {
}
/**
* <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>
*
* <p>This is output before the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param sizeStartText the new start of size text
*/
@ -457,7 +458,7 @@ public void setSizeStartText(String sizeStartText) {
//---------------------------------------------------------------------
/**
* 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>
*
* <p>This is output after the size value.</p>
@ -469,13 +470,13 @@ public String getSizeEndText() {
}
/**
* <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>
*
* <p>This is output after the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted
* to a Empty String.</p>
* <p><code>null</code> is accepted, but will be converted
* to an empty String.</p>
*
* @param sizeEndText the new end of size text
*/
@ -486,7 +487,7 @@ public void setSizeEndText(String sizeEndText) {
//---------------------------------------------------------------------
/**
* <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>
*
* <P>This is output before the size value.</p>
@ -498,13 +499,13 @@ public String getSummaryObjectStartText() {
}
/**
* <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>
*
* <p>This is output before the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param summaryObjectStartText the new start of summary text
*/
@ -515,7 +516,7 @@ public void setSummaryObjectStartText(String summaryObjectStartText) {
//---------------------------------------------------------------------
/**
* <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>
*
* <p>This is output after the size value.</p>
@ -527,13 +528,13 @@ public String getSummaryObjectEndText() {
}
/**
* <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>
*
* <p>This is output after the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param summaryObjectEndText the new end of summary text
*/

View File

@ -57,7 +57,7 @@
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
* class or object. This class aims to simplify the process by:</p>
@ -99,7 +99,7 @@
*
* <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
* <code>reflectionToString</code>, uses <code>AccessibleObject.setAccessible</code> to
* change the visibility of the fields. This will fail under a security manager,
* unless the appropriate permissions are set up correctly. It is also
* slower than testing explicitly.</p>
@ -123,8 +123,9 @@
*
* @author Stephen Colebourne
* @author Gary Gregory
* @author Pete Gieser
* @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 {
@ -288,7 +289,7 @@ public ToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer)
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> an <code>boolean</code>
* <p>Append to the <code>toString</code> a <code>boolean</code>
* value.</p>
*
* @param value the value to add to the <code>toString</code>
@ -316,7 +317,7 @@ public ToStringBuilder append(boolean[] array) {
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> an <code>byte</code>
* <p>Append to the <code>toString</code> a <code>byte</code>
* value.</p>
*
* @param value the value to add to the <code>toString</code>
@ -344,7 +345,7 @@ public ToStringBuilder append(byte[] array) {
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> an <code>char</code>
* <p>Append to the <code>toString</code> a <code>char</code>
* value.</p>
*
* @param value the value to add to the <code>toString</code>
@ -372,7 +373,7 @@ public ToStringBuilder append(char[] array) {
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> an <code>double</code>
* <p>Append to the <code>toString</code> a <code>double</code>
* value.</p>
*
* @param value the value to add to the <code>toString</code>
@ -400,7 +401,7 @@ public ToStringBuilder append(double[] array) {
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> an <code>float</code>
* <p>Append to the <code>toString</code> a <code>float</code>
* value.</p>
*
* @param value the value to add to the <code>toString</code>
@ -442,7 +443,7 @@ public ToStringBuilder append(int value) {
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> a <code>int</code>
* <p>Append to the <code>toString</code> an <code>int</code>
* array.</p>
*
* @param array the array to add to the <code>toString</code>
@ -512,7 +513,7 @@ public ToStringBuilder append(Object[] array) {
//----------------------------------------------------------------------------
/**
* <p>Append to the <code>toString</code> an <code>short</code>
* <p>Append to the <code>toString</code> a <code>short</code>
* value.</p>
*
* @param value the value to add to the <code>toString</code>
@ -538,7 +539,7 @@ public ToStringBuilder append(short[] array) {
}
/**
* <p>Append to the <code>toString</code> an <code>boolean</code>
* <p>Append to the <code>toString</code> a <code>boolean</code>
* value.</p>
*
* @param fieldName the field name
@ -551,7 +552,7 @@ public ToStringBuilder append(String fieldName, boolean value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>boolean</code>
* <p>Append to the <code>toString</code> a <code>boolean</code>
* array.</p>
*
* @param fieldName the field name
@ -597,11 +598,10 @@ public ToStringBuilder append(String fieldName, byte value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>byte</code>
* array.</p>
* <p>Append to the <code>toString</code> a <code>byte</code> array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, byte[] array) {
@ -630,7 +630,7 @@ public ToStringBuilder append(String fieldName, byte[] array, boolean fullDetail
}
/**
* <p>Append to the <code>toString</code> an <code>char</code>
* <p>Append to the <code>toString</code> a <code>char</code>
* value.</p>
*
* @param fieldName the field name
@ -643,11 +643,11 @@ public ToStringBuilder append(String fieldName, char value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>char</code>
* <p>Append to the <code>toString</code> a <code>char</code>
* array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, char[] array) {
@ -676,7 +676,7 @@ public ToStringBuilder append(String fieldName, char[] array, boolean fullDetail
}
/**
* <p>Append to the <code>toString</code> an <code>double</code>
* <p>Append to the <code>toString</code> a <code>double</code>
* value.</p>
*
* @param fieldName the field name
@ -689,11 +689,11 @@ public ToStringBuilder append(String fieldName, double value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>double</code>
* <p>Append to the <code>toString</code> a <code>double</code>
* array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, double[] array) {
@ -735,11 +735,11 @@ public ToStringBuilder append(String fieldName, float value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>float</code>
* <p>Append to the <code>toString</code> a <code>float</code>
* array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, float[] array) {
@ -781,11 +781,11 @@ public ToStringBuilder append(String fieldName, int value) {
}
/**
* <p>Append a <code>hashCode</code> for an <code>int</code>
* <p>Append to the <code>toString</code> an <code>int</code>
* array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, int[] array) {
@ -827,11 +827,11 @@ public ToStringBuilder append(String fieldName, long value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>long</code>
* <p>Append to the <code>toString</code> a <code>long</code>
* array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, long[] array) {
@ -934,11 +934,11 @@ public ToStringBuilder append(String fieldName, short value) {
}
/**
* <p>Append a <code>hashCode</code> for a <code>short</code>
* <p>Append to the <code>toString</code> a <code>short</code>
* array.</p>
*
* @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
*/
public ToStringBuilder append(String fieldName, short[] array) {
@ -983,10 +983,10 @@ public ToStringBuilder appendAsObjectToString(Object object) {
/**
* <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>
*
* <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>
* @return this
@ -1002,7 +1002,7 @@ public ToStringBuilder appendSuper(String superToString) {
* <p>Append the <code>toString</code> from another object.</p>
*
* <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>
*
* <pre>
@ -1016,7 +1016,7 @@ public ToStringBuilder appendSuper(String superToString) {
* toString();
* }</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>
*
* <p>If the <code>toString</code> is <code>null</code>, no change is made.</p>
@ -1054,7 +1054,7 @@ public ToStringStyle getStyle() {
/**
* <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>
*
* @return the String <code>toString</code>

View File

@ -84,8 +84,9 @@
*
* @author Stephen Colebourne
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Pete Gieser
* @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 {
@ -201,9 +202,9 @@ protected ToStringStyle() {
//----------------------------------------------------------------------------
/**
* <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 superToString the <code>super.toString()</code>
@ -213,12 +214,12 @@ public void appendSuper(StringBuffer buffer, String superToString) {
}
/**
* <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 toString the <code>super.toString()</code>
* @param toString the additional <code>toString</code>
*/
public void appendToString(StringBuffer buffer, String toString) {
if (toString != null) {
@ -236,7 +237,7 @@ public void appendToString(StringBuffer buffer, String toString) {
}
/**
* <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 object the <code>Object</code> to build a
@ -252,7 +253,7 @@ public void appendStart(StringBuffer buffer, Object object) {
}
/**
* <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 object the <code>Object</code> to build a
@ -315,7 +316,7 @@ public void append(StringBuffer buffer, String fieldName, Object value, Boolean
/**
* <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
* route arrays, <code>Collections</code>, <code>Maps</code> and
@ -754,7 +755,7 @@ protected void appendDetail(StringBuffer buffer, String fieldName, Object[] arra
}
/**
* <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 fieldName the field name, typically not used as already appended
@ -1283,7 +1284,7 @@ protected void appendSummary(StringBuffer buffer, String fieldName, boolean[] ar
//----------------------------------------------------------------------------
/**
* <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 object the <code>Object</code> whose name to output
@ -1312,7 +1313,7 @@ protected void appendIdentityHashCode(StringBuffer buffer, Object object) {
}
/**
* <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
*/
@ -1321,7 +1322,7 @@ protected void appendContentStart(StringBuffer buffer) {
}
/**
* <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
*/
@ -1330,7 +1331,7 @@ protected void appendContentEnd(StringBuffer buffer) {
}
/**
* <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>
*
@ -1342,7 +1343,7 @@ protected void appendNullText(StringBuffer buffer, String fieldName) {
}
/**
* <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
*/
@ -1351,7 +1352,7 @@ protected void appendFieldSeparator(StringBuffer buffer) {
}
/**
* <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 fieldName the field name
@ -1364,7 +1365,7 @@ protected void appendFieldStart(StringBuffer buffer, String fieldName) {
}
/**
* <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 fieldName the field name, typically not used as already appended
@ -1572,8 +1573,8 @@ protected String getArrayStart() {
/**
* <p>Sets the array start text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a emptry String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param arrayStart the new array start text
*/
@ -1598,8 +1599,8 @@ protected String getArrayEnd() {
/**
* <p>Sets the array end text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param arrayEnd the new array end text
*/
@ -1624,8 +1625,8 @@ protected String getArraySeparator() {
/**
* <p>Sets the array separator text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param arraySeparator the new array separator text
*/
@ -1650,8 +1651,8 @@ protected String getContentStart() {
/**
* <p>Sets the content start text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param contentStart the new content start text
*/
@ -1676,8 +1677,8 @@ protected String getContentEnd() {
/**
* <p>Sets the content end text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param contentEnd the new content end text
*/
@ -1702,8 +1703,8 @@ protected String getFieldNameValueSeparator() {
/**
* <p>Sets the field name value separator text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param fieldNameValueSeparator the new field name value separator text
*/
@ -1728,8 +1729,8 @@ protected String getFieldSeparator() {
/**
* <p>Sets the field separator text.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param fieldSeparator the new field separator text
*/
@ -1798,8 +1799,8 @@ protected String getNullText() {
/**
* <p>Sets the text to output when <code>null</code> found.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param nullText the new text to output when null found
*/
@ -1813,7 +1814,7 @@ protected void setNullText(String nullText) {
//---------------------------------------------------------------------
/**
* <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>
*
* <p>This is output before the size value.</p>
@ -1825,13 +1826,13 @@ protected String getSizeStartText() {
}
/**
* <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>
*
* <p>This is output before the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param sizeStartText the new start of size text
*/
@ -1845,7 +1846,7 @@ protected void setSizeStartText(String sizeStartText) {
//---------------------------------------------------------------------
/**
* <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>
*
* <p>This is output after the size value.</p>
@ -1857,13 +1858,13 @@ protected String getSizeEndText() {
}
/**
* <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>
*
* <p>This is output after the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param sizeEndText the new end of size text
*/
@ -1877,7 +1878,7 @@ protected void setSizeEndText(String sizeEndText) {
//---------------------------------------------------------------------
/**
* <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>
*
* <p>This is output before the size value.</p>
@ -1889,13 +1890,13 @@ protected String getSummaryObjectStartText() {
}
/**
* <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>
*
* <p>This is output before the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param summaryObjectStartText the new start of summary text
*/
@ -1909,7 +1910,7 @@ protected void setSummaryObjectStartText(String summaryObjectStartText) {
//---------------------------------------------------------------------
/**
* <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>
*
* <p>This is output after the size value.</p>
@ -1921,13 +1922,13 @@ protected String getSummaryObjectEndText() {
}
/**
* <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>
*
* <p>This is output after the size value.</p>
*
* <p><code>Null</code> is accepted, but will be converted to
* a empty String.</p>
* <p><code>null</code> is accepted, but will be converted to
* an empty String.</p>
*
* @param summaryObjectEndText the new end of summary text
*/