Added methods back in that were lost in r397016 (my fault). Testing with jardiff again, there are now no removed or changed methods - in keeping with a minor release.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@447139 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2006-09-17 20:36:53 +00:00
parent 066873b5c2
commit e0c25af499
3 changed files with 48 additions and 10 deletions

View File

@ -13,15 +13,7 @@ should be of use in any Java environment.
INCOMPATIBLE CHANGES WITH VERSION 2.1:
(Review these incompatible changes, shouldn't be happening until 3.0)
- Class changed: org.apache.commons.lang.builder.CompareToBuilder
Methods removed:
public static int reflectionCompare(Object, Object, boolean, Class);
- Class changed: org.apache.commons.lang.builder.HashCodeBuilder
Methods removed:
public static int reflectionHashCode(int, int, Object, boolean, Class);
- None
ADDITIONAL INCOMPATIBLE CHANGES WITH VERSION 2.0:

View File

@ -201,6 +201,7 @@ public class CompareToBuilder {
* (but not both) is <code>null</code>
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
* with <code>lhs</code>
* @since 2.2
*/
public static int reflectionCompare(Object lhs, Object rhs, Collection /*String*/ excludeFields) {
return reflectionCompare(lhs, rhs, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
@ -233,11 +234,49 @@ public class CompareToBuilder {
* (but not both) is <code>null</code>
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
* with <code>lhs</code>
* @since 2.2
*/
public static int reflectionCompare(Object lhs, Object rhs, String[] excludeFields) {
return reflectionCompare(lhs, rhs, false, null, excludeFields);
}
/**
* <p>Compares two <code>Object</code>s via reflection.</p>
*
* <p>Fields can be private, thus <code>AccessibleObject.setAccessible</code>
* is used to bypass normal access control checks. This will fail under a
* security manager unless the appropriate permissions are set.</p>
*
* <ul>
* <li>Static fields will not be compared</li>
* <li>If the <code>compareTransients</code> is <code>true</code>,
* compares transient members. Otherwise ignores them, as they
* are likely derived fields.</li>
* <li>Compares superclass fields up to and including <code>reflectUpToClass</code>.
* If <code>reflectUpToClass</code> is <code>null</code>, compares all superclass fields.</li>
* </ul>
*
* <p>If both <code>lhs</code> and <code>rhs</code> are <code>null</code>,
* they are considered equal.</p>
*
* @param lhs left-hand object
* @param rhs right-hand object
* @param compareTransients whether to compare transient fields
* @param reflectUpToClass last superclass for which fields are compared
* @return a negative integer, zero, or a positive integer as <code>lhs</code>
* is less than, equal to, or greater than <code>rhs</code>
* @throws NullPointerException if either <code>lhs</code> or <code>rhs</code>
* (but not both) is <code>null</code>
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
* with <code>lhs</code>
* @since 2.0
*/
public static int reflectionCompare(Object lhs, Object rhs, boolean compareTransients,
Class reflectUpToClass)
{
return reflectionCompare(lhs, rhs, false, reflectUpToClass, null);
}
/**
* <p>Compares two <code>Object</code>s via reflection.</p>
*
@ -268,7 +307,7 @@ public class CompareToBuilder {
* (but not both) is <code>null</code>
* @throws ClassCastException if <code>rhs</code> is not assignment-compatible
* with <code>lhs</code>
* @since 2.0
* @since 2.2
*/
public static int reflectionCompare(
Object lhs,

View File

@ -294,6 +294,13 @@ public class HashCodeBuilder {
);
}
public static int reflectionHashCode(int initialNonZeroOddNumber, int multiplierNonZeroOddNumber,
Object object, boolean testTransients, Class reflectUpToClass)
{
return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object,
testTransients, reflectUpToClass, null);
}
/**
* <p>This method uses reflection to build a valid hash code.</p>
*