You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2006/09/17 22:36:54 UTC
svn commit: r447139 - in /jakarta/commons/proper/lang/trunk:
RELEASE-NOTES.txt
src/java/org/apache/commons/lang/builder/CompareToBuilder.java
src/java/org/apache/commons/lang/builder/HashCodeBuilder.java
Author: bayard
Date: Sun Sep 17 13:36:53 2006
New Revision: 447139
URL: http://svn.apache.org/viewvc?view=rev&rev=447139
Log:
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.
Modified:
jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/CompareToBuilder.java
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java
Modified: jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt?view=diff&rev=447139&r1=447138&r2=447139
==============================================================================
--- jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt Sun Sep 17 13:36:53 2006
@@ -13,15 +13,7 @@
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:
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/CompareToBuilder.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/CompareToBuilder.java?view=diff&rev=447139&r1=447138&r2=447139
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/CompareToBuilder.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/CompareToBuilder.java Sun Sep 17 13:36:53 2006
@@ -201,6 +201,7 @@
* (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,6 +234,7 @@
* (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);
@@ -261,7 +263,6 @@
* @param rhs right-hand object
* @param compareTransients whether to compare transient fields
* @param reflectUpToClass last superclass for which fields are compared
- * @param excludeFields fields to exclude
* @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>
@@ -269,6 +270,44 @@
* @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>
+ *
+ * <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
+ * @param excludeFields fields to exclude
+ * @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.2
*/
public static int reflectionCompare(
Object lhs,
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java?view=diff&rev=447139&r1=447138&r2=447139
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java Sun Sep 17 13:36:53 2006
@@ -294,6 +294,13 @@
);
}
+ 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>
*
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org