You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2007/01/04 01:10:14 UTC
svn commit: r492361 - in /jakarta/commons/proper/lang/trunk:
RELEASE-NOTES.txt src/java/org/apache/commons/lang/BooleanUtils.java
src/test/org/apache/commons/lang/BooleanUtilsTest.java
Author: scolebourne
Date: Wed Jan 3 16:10:13 2007
New Revision: 492361
URL: http://svn.apache.org/viewvc?view=rev&rev=492361
Log:
LANG-310 - BooleanUtils isNotTrue/isNotFalse
Modified:
jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.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=492361&r1=492360&r2=492361
==============================================================================
--- jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt (original)
+++ jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt Wed Jan 3 16:10:13 2007
@@ -81,4 +81,5 @@
* [LANG-291] - Null-safe comparison methods for finding most recent / least recent dates.
* [LANG-282] - Create more tests to test out the +=31 replacement code in DurationFormatUtils.
* [LANG-266] - Wish for StringUtils.join(Collection, *)
+ * [LANG-310] - BooleanUtils isNotTrue/isNotFalse
Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java?view=diff&rev=492361&r1=492360&r2=492361
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java Wed Jan 3 16:10:13 2007
@@ -70,7 +70,8 @@
// boolean Boolean methods
//-----------------------------------------------------------------------
/**
- * <p>Is a Boolean value <code>true</code>, handling <code>null</code>.</p>
+ * <p>Checks if a <code>Boolean</code> value is <code>true</code>,
+ * handling <code>null</code> by returning <code>false</code>.</p>
*
* <pre>
* BooleanUtils.isTrue(Boolean.TRUE) = true
@@ -78,7 +79,7 @@
* BooleanUtils.isTrue(null) = false
* </pre>
*
- * @param bool the boolean to convert
+ * @param bool the boolean to check, null returns <code>false</code>
* @return <code>true</code> only if the input is non-null and true
* @since 2.1
*/
@@ -90,7 +91,26 @@
}
/**
- * <p>Is a Boolean value <code>false</code>, handling <code>null</code>.</p>
+ * <p>Checks if a <code>Boolean</code> value is <i>not</i> <code>true</code>,
+ * handling <code>null</code> by returning <code>true</code>.</p>
+ *
+ * <pre>
+ * BooleanUtils.isNotTrue(Boolean.TRUE) = false
+ * BooleanUtils.isNotTrue(Boolean.FALSE) = true
+ * BooleanUtils.isNotTrue(null) = true
+ * </pre>
+ *
+ * @param bool the boolean to check, null returns <code>true</code>
+ * @return <code>true</code> if the input is null or false
+ * @since 2.3
+ */
+ public static boolean isNotTrue(Boolean bool) {
+ return !isTrue(bool);
+ }
+
+ /**
+ * <p>Checks if a <code>Boolean</code> value is <code>false</code>,
+ * handling <code>null</code> by returning <code>false</code>.</p>
*
* <pre>
* BooleanUtils.isFalse(Boolean.TRUE) = false
@@ -98,7 +118,7 @@
* BooleanUtils.isFalse(null) = false
* </pre>
*
- * @param bool the boolean to convert
+ * @param bool the boolean to check, null returns <code>false</code>
* @return <code>true</code> only if the input is non-null and false
* @since 2.1
*/
@@ -109,6 +129,25 @@
return bool.booleanValue() ? false : true;
}
+ /**
+ * <p>Checks if a <code>Boolean</code> value is <i>not</i> <code>false</code>,
+ * handling <code>null</code> by returning <code>true</code>.</p>
+ *
+ * <pre>
+ * BooleanUtils.isNotTrue(Boolean.TRUE) = true
+ * BooleanUtils.isNotTrue(Boolean.FALSE) = false
+ * BooleanUtils.isNotTrue(null) = true
+ * </pre>
+ *
+ * @param bool the boolean to check, null returns <code>true</code>
+ * @return <code>true</code> if the input is null or true
+ * @since 2.3
+ */
+ public static boolean isNotFalse(Boolean bool) {
+ return !isFalse(bool);
+ }
+
+ //-----------------------------------------------------------------------
/**
* <p>Boolean factory that avoids creating new Boolean objecs all the time.</p>
*
Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java?view=diff&rev=492361&r1=492360&r2=492361
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java (original)
+++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java Wed Jan 3 16:10:13 2007
@@ -79,10 +79,23 @@
assertEquals(false, BooleanUtils.isTrue((Boolean) null));
}
+ public void test_isNotTrue_Boolean() {
+ assertEquals(false, BooleanUtils.isNotTrue(Boolean.TRUE));
+ assertEquals(true, BooleanUtils.isNotTrue(Boolean.FALSE));
+ assertEquals(true, BooleanUtils.isNotTrue((Boolean) null));
+ }
+
+ //-----------------------------------------------------------------------
public void test_isFalse_Boolean() {
assertEquals(false, BooleanUtils.isFalse(Boolean.TRUE));
assertEquals(true, BooleanUtils.isFalse(Boolean.FALSE));
assertEquals(false, BooleanUtils.isFalse((Boolean) null));
+ }
+
+ public void test_isNotFalse_Boolean() {
+ assertEquals(true, BooleanUtils.isNotFalse(Boolean.TRUE));
+ assertEquals(false, BooleanUtils.isNotFalse(Boolean.FALSE));
+ assertEquals(true, BooleanUtils.isNotFalse((Boolean) null));
}
//-----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] svn commit: r492361 - in /jakarta/commons/proper/lang/trunk:
RELEASE-NOTES.txt src/java/org/apache/commons/lang/BooleanUtils.java src/test/org/apache/commons/lang/BooleanUtilsTest.java
Posted by Stephen Colebourne <sc...@btopenworld.com>.
Rahul Akolkar wrote:
>> + * BooleanUtils.isNotTrue(Boolean.TRUE) = true
>> + * BooleanUtils.isNotTrue(Boolean.FALSE) = false
>> + * BooleanUtils.isNotTrue(null) = true
>> + */
>> + public static boolean isNotFalse(Boolean bool) {
>> + return !isFalse(bool);
>> + }
>> +
> <snap/>
>
> Javadoc for this method (<pre> section) has incorrect method name.
Fixed, ta!
Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [lang] svn commit: r492361 - in /jakarta/commons/proper/lang/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/lang/BooleanUtils.java src/test/org/apache/commons/lang/BooleanUtilsTest.java
Posted by Rahul Akolkar <ra...@gmail.com>.
On 1/3/07, scolebourne@apache.org <sc...@apache.org> wrote:
> Author: scolebourne
> Date: Wed Jan 3 16:10:13 2007
> New Revision: 492361
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=492361
> Log:
> LANG-310 - BooleanUtils isNotTrue/isNotFalse
>
> Modified:
> jakarta/commons/proper/lang/trunk/RELEASE-NOTES.txt
> jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/BooleanUtils.java
> jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/BooleanUtilsTest.java
>
<snip/>
> + /**
> + * <p>Checks if a <code>Boolean</code> value is <i>not</i> <code>false</code>,
> + * handling <code>null</code> by returning <code>true</code>.</p>
> + *
> + * <pre>
> + * BooleanUtils.isNotTrue(Boolean.TRUE) = true
> + * BooleanUtils.isNotTrue(Boolean.FALSE) = false
> + * BooleanUtils.isNotTrue(null) = true
> + * </pre>
> + *
> + * @param bool the boolean to check, null returns <code>true</code>
> + * @return <code>true</code> if the input is null or true
> + * @since 2.3
> + */
> + public static boolean isNotFalse(Boolean bool) {
> + return !isFalse(bool);
> + }
> +
<snap/>
Javadoc for this method (<pre> section) has incorrect method name.
-Rahul
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org