commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r763559 - in /commons/proper/lang/trunk/src: java/org/apache/commons/lang/ java/org/apache/commons/lang/builder/ java/org/apache/commons/lang/mutable/ test/org/apache/commons/lang/
Date Thu, 09 Apr 2009 08:34:48 GMT
Author: bayard
Date: Thu Apr  9 08:34:47 2009
New Revision: 763559

URL: http://svn.apache.org/viewvc?rev=763559&view=rev
Log:
Removing BooleanUtils.toBooleanObject(boolean) as JDK 1.4 provides Boolean.valueOf(boolean)
- even if we ignore autoboxing. LANG-492

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java?rev=763559&r1=763558&r2=763559&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/ArrayUtils.java Thu Apr  9
08:34:47 2009
@@ -3538,7 +3538,7 @@
      * (index < 0 || index > array.length).
      */
     public static boolean[] add(boolean[] array, int index, boolean element) {
-        return (boolean[]) add(array, index, BooleanUtils.toBooleanObject(element), Boolean.TYPE);
+        return (boolean[]) add(array, index, Boolean.valueOf(element), Boolean.TYPE);
     }
     
     /**

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java?rev=763559&r1=763558&r2=763559&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java Thu Apr 
9 08:34:47 2009
@@ -35,7 +35,7 @@
 
     /**
      * <p><code>BooleanUtils</code> instances should NOT be constructed
in standard programming.
-     * Instead, the class should be used as <code>BooleanUtils.toBooleanObject(true);</code>.</p>
+     * Instead, the class should be used as <code>BooleanUtils.negate(true);</code>.</p>
      *
      * <p>This constructor is public to permit tools that require a JavaBean instance
      * to operate.</p>
@@ -149,23 +149,6 @@
 
     //-----------------------------------------------------------------------
     /**
-     * <p>Boolean factory that avoids creating new Boolean objecs all the time.</p>
-     * 
-     * <p>This method was added to JDK1.4 but is available here for earlier JDKs.</p>
-     *
-     * <pre>
-     *   BooleanUtils.toBooleanObject(false) = Boolean.FALSE
-     *   BooleanUtils.toBooleanObject(true)  = Boolean.TRUE
-     * </pre>
-     *
-     * @param bool  the boolean to convert
-     * @return Boolean.TRUE or Boolean.FALSE as appropriate
-     */
-    public static Boolean toBooleanObject(boolean bool) {
-        return bool ? Boolean.TRUE : Boolean.FALSE;
-    }
-    
-    /**
      * <p>Converts a Boolean to a boolean handling <code>null</code>
      * by returning <code>false</code>.</p>
      *

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java?rev=763559&r1=763558&r2=763559&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
Thu Apr  9 08:34:47 2009
@@ -549,7 +549,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, boolean[] array, boolean fullDetail)
{
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -594,7 +594,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, byte[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -640,7 +640,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, char[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -686,7 +686,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, double[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -732,7 +732,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, float[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -778,7 +778,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, int[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -824,7 +824,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, long[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -852,7 +852,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, Object obj, boolean fullDetail) {
-        style.append(buffer, fieldName, obj, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, obj, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -885,7 +885,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, Object[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 
@@ -931,7 +931,7 @@
      * @return this
      */
     public ToStringBuilder append(String fieldName, short[] array, boolean fullDetail) {
-        style.append(buffer, fieldName, array, BooleanUtils.toBooleanObject(fullDetail));
+        style.append(buffer, fieldName, array, Boolean.valueOf(fullDetail));
         return this;
     }
 

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java?rev=763559&r1=763558&r2=763559&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
Thu Apr  9 08:34:47 2009
@@ -124,7 +124,7 @@
      * @return the value as a Boolean
      */
     public Object getValue() {
-        return BooleanUtils.toBooleanObject(this.value);
+        return Boolean.valueOf(this.value);
     }
 
     /**

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java?rev=763559&r1=763558&r2=763559&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java Thu Apr
 9 08:34:47 2009
@@ -101,11 +101,6 @@
     }
 
     //-----------------------------------------------------------------------
-    public void test_toBooleanObject_boolean() {
-        assertSame(Boolean.TRUE, BooleanUtils.toBooleanObject(true));
-        assertSame(Boolean.FALSE, BooleanUtils.toBooleanObject(false));
-    }
-
     public void test_toBoolean_Boolean() {
         assertEquals(true, BooleanUtils.toBoolean(Boolean.TRUE));
         assertEquals(false, BooleanUtils.toBoolean(Boolean.FALSE));



Mime
View raw message