Author: bayard
Date: Sat May 16 08:26:07 2009
New Revision: 775432
URL: http://svn.apache.org/viewvc?rev=775432&view=rev
Log:
Cloning the output from getExcludeFieldNames, adjusting the code to use the
attribute directly so it doesn't pay the clone() cost every time and changing
the attribute from private to protected to let subclasses retain the ability to
modify the field names (if that is why a getExcludeFieldNames method existed).
Document in LANG-489
Modified:
commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
Modified:
commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
URL:
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java?rev=775432&r1=775431&r2=775432&view=diff
==============================================================================
---
commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
(original)
+++
commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
Sat May 16 08:26:07 2009
@@ -378,7 +378,7 @@
/**
* Which field names to exclude from output. Intended for fields like
<code>"password"</code>.
*/
- private String[] excludeFieldNames;
+ protected String[] excludeFieldNames;
/**
* The last super class to stop appending fields for.
@@ -496,11 +496,11 @@
return false;
}
if (Modifier.isStatic(field.getModifiers()) &&
!this.isAppendStatics()) {
- // Rject static fields.
+ // Reject static fields.
return false;
}
- if (this.getExcludeFieldNames() != null
- && Arrays.binarySearch(this.getExcludeFieldNames(),
field.getName()) >= 0) {
+ if (this.excludeFieldNames != null
+ && Arrays.binarySearch(this.excludeFieldNames, field.getName()) >=
0) {
// Reject fields from the getExcludeFieldNames list.
return false;
}
@@ -550,7 +550,7 @@
* @return Returns the excludeFieldNames.
*/
public String[] getExcludeFieldNames() {
- return this.excludeFieldNames;
+ return this.excludeFieldNames.clone();
}
/**