Author: oheger
Date: Sat Mar 19 16:42:55 2011
New Revision: 1083218
URL: http://svn.apache.org/viewvc?rev=1083218&view=rev
Log:
Checkstyle and trailing spaces.
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
Modified:
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
URL:
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java?rev=1083218&r1=1083217&r2=1083218&view=diff
==============================================================================
---
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
(original)
+++
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
Sat Mar 19 16:42:55 2011
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,34 +32,34 @@ import org.apache.commons.lang3.ClassUti
* <p>
* Assists in implementing {@link Object#toString()} methods using reflection.
* </p>
- *
+ *
* <p>
* This class uses reflection to determine the fields to append. Because these
fields are usually private, the class
* uses {@link
java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[],
boolean)} to
* change the visibility of the fields. This will fail under a security
manager, unless the appropriate permissions are
* set up correctly.
* </p>
- *
+ *
* <p>
* A typical invocation for this method would look like:
* </p>
- *
+ *
* <pre>
* public String toString() {
* return ReflectionToStringBuilder.toString(this);
* }</pre>
- *
- *
- *
+ *
+ *
+ *
* <p>
* You can also use the builder to debug 3rd party objects:
* </p>
- *
+ *
* <pre>
* System.out.println("An object: " +
ReflectionToStringBuilder.toString(anObject));</pre>
- *
- *
- *
+ *
+ *
+ *
* <p>
* A subclass can control field output by overriding the methods:
* <ul>
@@ -71,7 +71,7 @@ import org.apache.commons.lang3.ClassUti
* For example, this method does <i>not</i> include the <code>password</code>
field in the returned
* <code>String</code>:
* </p>
- *
+ *
* <pre>
* public String toString() {
* return (new ReflectionToStringBuilder(this) {
@@ -80,14 +80,14 @@ import org.apache.commons.lang3.ClassUti
* }
* }).toString();
* }</pre>
- *
- *
- *
+ *
+ *
+ *
* <p>
* The exact format of the <code>toString</code> is determined by the {@link
ToStringStyle} passed into the
* constructor.
* </p>
- *
+ *
* @author Apache Software Foundation
* @author Gary Gregory
* @author Pete Gieser
@@ -100,18 +100,18 @@ public class ReflectionToStringBuilder e
* <p>
* Builds a <code>toString</code> value using the default
<code>ToStringStyle</code> through reflection.
* </p>
- *
+ *
* <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 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.
Static fields will not be included.
* Superclass fields will be appended.
* </p>
- *
+ *
* @param object
* the Object to be output
* @return the String result
@@ -126,22 +126,22 @@ public class ReflectionToStringBuilder e
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
- *
+ *
* <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 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.
Static fields will not be included.
* Superclass fields will be appended.
* </p>
- *
+ *
* <p>
* If the style is <code>null</code>, the default
<code>ToStringStyle</code> is used.
* </p>
- *
+ *
* @param object
* the Object to be output
* @param style
@@ -158,26 +158,26 @@ public class ReflectionToStringBuilder e
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
- *
+ *
* <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 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>, transient
members will be output, otherwise they
* are ignored, as they are likely derived fields, and not part of the
value of the Object.
* </p>
- *
+ *
* <p>
* Static fields will not be included. Superclass fields will be appended.
* </p>
- *
+ *
* <p>
* If the style is <code>null</code>, the default
<code>ToStringStyle</code> is used.
* </p>
- *
+ *
* @param object
* the Object to be output
* @param style
@@ -196,31 +196,31 @@ public class ReflectionToStringBuilder e
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
- *
+ *
* <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 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>, transient
fields will be output, otherwise they
* are ignored, as they are likely derived fields, and not part of the
value of the Object.
* </p>
- *
+ *
* <p>
* If the <code>outputStatics</code> is <code>true</code>, static fields
will be output, otherwise they are
* ignored.
* </p>
- *
+ *
* <p>
* Static fields will not be included. Superclass fields will be appended.
* </p>
- *
+ *
* <p>
* If the style is <code>null</code>, the default
<code>ToStringStyle</code> is used.
* </p>
- *
+ *
* @param object
* the Object to be output
* @param style
@@ -242,32 +242,34 @@ public class ReflectionToStringBuilder e
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
- *
+ *
* <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 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>, transient
fields will be output, otherwise they
* are ignored, as they are likely derived fields, and not part of the
value of the Object.
* </p>
- *
+ *
* <p>
* If the <code>outputStatics</code> is <code>true</code>, static fields
will be output, otherwise they are
* ignored.
* </p>
- *
+ *
* <p>
* Superclass fields will be appended up to and including the specified
superclass. A null superclass is treated as
* <code>java.lang.Object</code>.
* </p>
- *
+ *
* <p>
* If the style is <code>null</code>, the default
<code>ToStringStyle</code> is used.
* </p>
- *
+ *
+ * @param <T>
+ * the type of the object
* @param object
* the Object to be output
* @param style
@@ -292,7 +294,7 @@ public class ReflectionToStringBuilder e
/**
* Builds a String for a toString method excluding the given field name.
- *
+ *
* @param object
* The object to "toString".
* @param excludeFieldName
@@ -305,7 +307,7 @@ public class ReflectionToStringBuilder e
/**
* Builds a String for a toString method excluding the given field names.
- *
+ *
* @param object
* The object to "toString".
* @param excludeFieldNames
@@ -318,9 +320,9 @@ public class ReflectionToStringBuilder e
/**
* Converts the given Collection into an array of Strings. The returned
array does not contain <code>null</code>
- * entries. Note that {@link Arrays#sort(Object[])} will throw an {@link
NullPointerException} if an array element
+ * entries. Note that {@link Arrays#sort(Object[])} will throw an {@link
NullPointerException} if an array element
* is <code>null</code>.
- *
+ *
* @param collection
* The collection to convert
* @return A new array of Strings.
@@ -334,9 +336,9 @@ public class ReflectionToStringBuilder e
/**
* Returns a new array of Strings without null elements. Internal method
used to normalize exclude lists
- * (arrays and collections). Note that {@link Arrays#sort(Object[])} will
throw an {@link NullPointerException}
+ * (arrays and collections). Note that {@link Arrays#sort(Object[])} will
throw an {@link NullPointerException}
* if an array element is <code>null</code>.
- *
+ *
* @param array
* The array to check
* @return The given array or a new array without null.
@@ -350,11 +352,11 @@ public class ReflectionToStringBuilder e
}
return list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}
-
+
/**
* Builds a String for a toString method excluding the given field names.
- *
+ *
* @param object
* The object to "toString".
* @param excludeFieldNames
@@ -391,11 +393,11 @@ public class ReflectionToStringBuilder e
* <p>
* Constructor.
* </p>
- *
+ *
* <p>
* This constructor outputs using the default style set with
<code>setDefaultStyle</code>.
* </p>
- *
+ *
* @param object
* the Object to build a <code>toString</code> for, must not be
<code>null</code>
* @throws IllegalArgumentException
@@ -409,11 +411,11 @@ public class ReflectionToStringBuilder e
* <p>
* Constructor.
* </p>
- *
+ *
* <p>
* If the style is <code>null</code>, the default style is used.
* </p>
- *
+ *
* @param object
* the Object to build a <code>toString</code> for, must not be
<code>null</code>
* @param style
@@ -429,15 +431,15 @@ public class ReflectionToStringBuilder e
* <p>
* Constructor.
* </p>
- *
+ *
* <p>
* If the style is <code>null</code>, the default style is used.
* </p>
- *
+ *
* <p>
* If the buffer is <code>null</code>, a new one is created.
* </p>
- *
+ *
* @param object
* the Object to build a <code>toString</code> for
* @param style
@@ -453,7 +455,9 @@ public class ReflectionToStringBuilder e
/**
* Constructor.
- *
+ *
+ * @param <T>
+ * the type of the object
* @param object
* the Object to build a <code>toString</code> for
* @param style
@@ -484,7 +488,7 @@ public class ReflectionToStringBuilder e
* <li>Static fields are appended only if {@link #isAppendStatics()}
returns <code>true</code>.
* <li>Inner class fields are not appened.</li>
* </ul>
- *
+ *
* @param field
* The Field to test.
* @return Whether or not to append the given <code>Field</code>.
@@ -514,12 +518,12 @@ public class ReflectionToStringBuilder e
* <p>
* Appends the fields and values defined by the given object of the given
Class.
* </p>
- *
+ *
* <p>
* If a cycle is detected as an object is "toString()'ed", such
an object is rendered as if
* <code>Object.toString()</code> had been called and not implemented by
the object.
* </p>
- *
+ *
* @param clazz
* The class of object parameter
*/
@@ -560,7 +564,7 @@ public class ReflectionToStringBuilder e
* <p>
* Gets the last super class to stop appending fields for.
* </p>
- *
+ *
* @return The last super class to stop appending fields for.
*/
public Class<?> getUpToClass() {
@@ -571,16 +575,16 @@ public class ReflectionToStringBuilder e
* <p>
* Calls <code>java.lang.reflect.Field.get(Object)</code>.
* </p>
- *
+ *
* @param field
* The Field to query.
* @return The Object from the given Field.
- *
+ *
* @throws IllegalArgumentException
* see {@link java.lang.reflect.Field#get(Object)}
* @throws IllegalAccessException
* see {@link java.lang.reflect.Field#get(Object)}
- *
+ *
* @see java.lang.reflect.Field#get(Object)
*/
protected Object getValue(Field field) throws IllegalArgumentException,
IllegalAccessException {
@@ -591,7 +595,7 @@ public class ReflectionToStringBuilder e
* <p>
* Gets whether or not to append static fields.
* </p>
- *
+ *
* @return Whether or not to append static fields.
* @since 2.1
*/
@@ -603,7 +607,7 @@ public class ReflectionToStringBuilder e
* <p>
* Gets whether or not to append transient fields.
* </p>
- *
+ *
* @return Whether or not to append transient fields.
*/
public boolean isAppendTransients() {
@@ -614,7 +618,7 @@ public class ReflectionToStringBuilder e
* <p>
* Append to the <code>toString</code> an <code>Object</code> array.
* </p>
- *
+ *
* @param array
* the array to add to the <code>toString</code>
* @return this
@@ -628,7 +632,7 @@ public class ReflectionToStringBuilder e
* <p>
* Sets whether or not to append static fields.
* </p>
- *
+ *
* @param appendStatics
* Whether or not to append static fields.
* @since 2.1
@@ -641,7 +645,7 @@ public class ReflectionToStringBuilder e
* <p>
* Sets whether or not to append transient fields.
* </p>
- *
+ *
* @param appendTransients
* Whether or not to append transient fields.
*/
@@ -651,7 +655,7 @@ public class ReflectionToStringBuilder e
/**
* Sets the field names to exclude.
- *
+ *
* @param excludeFieldNamesParam
* The excludeFieldNames to excluding from toString or
<code>null</code>.
* @return <code>this</code>
@@ -670,7 +674,7 @@ public class ReflectionToStringBuilder e
* <p>
* Sets the last super class to stop appending fields for.
* </p>
- *
+ *
* @param clazz
* The last super class to stop appending fields for.
*/
@@ -688,7 +692,7 @@ public class ReflectionToStringBuilder e
* <p>
* Gets the String built by this builder.
* </p>
- *
+ *
* @return the built string
*/
@Override