commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r905148 - in /commons/proper/lang/branches/LANG_2_X/src: main/java/org/apache/commons/lang/mutable/MutableBoolean.java test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
Date Mon, 01 Feb 2010 00:16:27 GMT
Author: niallp
Date: Mon Feb  1 00:16:27 2010
New Revision: 905148

URL: http://svn.apache.org/viewvc?rev=905148&view=rev
Log:
Port r830016 to 2.x branch - add toBoolean() method to MutableBoolean

Modified:
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
    commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java?rev=905148&r1=905147&r2=905148&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
Mon Feb  1 00:16:27 2010
@@ -110,6 +110,16 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Gets this mutable as an instance of Boolean.
+     *
+     * @return a Boolean instance containing the value from this mutable, never null
+     */
+    public Boolean toBoolean() {
+        return  BooleanUtils.toBooleanObject(this.value);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Compares this object to the specified object. The result is <code>true</code>
if and only if the argument is
      * not <code>null</code> and is an <code>MutableBoolean</code>
object that contains the same
      * <code>boolean</code> value as this object.

Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java?rev=905148&r1=905147&r2=905148&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
Mon Feb  1 00:16:27 2010
@@ -105,10 +105,15 @@
     }
 
     public void testGetSet() {
-        final MutableBoolean mutBool = new MutableBoolean(false);
         assertEquals(false, new MutableBoolean().booleanValue());
+        assertEquals(Boolean.FALSE, new MutableBoolean().getValue());
+        
+        final MutableBoolean mutBool = new MutableBoolean(false);
+        assertEquals(Boolean.FALSE, mutBool.toBoolean());
+        assertEquals(false, mutBool.booleanValue());
 
         mutBool.setValue(Boolean.TRUE);
+        assertEquals(Boolean.TRUE, mutBool.toBoolean());
         assertEquals(true, mutBool.booleanValue());
 
         mutBool.setValue(false);



Mime
View raw message