LANG-896 BooleanUtils.toBoolean(String str) javadoc is not updated
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1488041 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dcde57852a
commit
ef9623ef8e
|
@ -22,6 +22,7 @@
|
|||
<body>
|
||||
|
||||
<release version="3.2" date="TBA" description="Next release">
|
||||
<action issue="LANG-896" type="fix" due-to="Mark Bryan Yu">BooleanUtils.toBoolean(String str) javadoc is not updated</action>
|
||||
<action issue="LANG-879" type="fix">LocaleUtils test fails with new Locale "ja_JP_JP_#u-ca-japanese" of JDK7</action>
|
||||
<action issue="LANG-836" type="fix" due-to="Arnaud Brunet">StrSubstitutor does not support StringBuilder or CharSequence</action>
|
||||
<action issue="LANG-693" type="fix" due-to="Calvin Echols">Method createNumber from NumberUtils doesn't work for floating point numbers other than Float</action>
|
||||
|
|
|
@ -513,26 +513,33 @@ public class BooleanUtils {
|
|||
/**
|
||||
* <p>Converts a String to a Boolean.</p>
|
||||
*
|
||||
* <p>{@code 'true'}, {@code 'on'} or {@code 'yes'}
|
||||
* <p>{@code 'true'}, {@code 'on'}, {@code 'y'}, {@code 't'} or {@code 'yes'}
|
||||
* (case insensitive) will return {@code true}.
|
||||
* {@code 'false'}, {@code 'off'} or {@code 'no'}
|
||||
* {@code 'false'}, {@code 'off'}, {@code 'n'}, {@code 'f'} or {@code 'no'}
|
||||
* (case insensitive) will return {@code false}.
|
||||
* Otherwise, {@code null} is returned.</p>
|
||||
*
|
||||
* <p>NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean. </p>
|
||||
*
|
||||
* <pre>
|
||||
* // N.B. case is not significant
|
||||
* BooleanUtils.toBooleanObject(null) = null
|
||||
* BooleanUtils.toBooleanObject("true") = Boolean.TRUE
|
||||
* BooleanUtils.toBooleanObject("T") = Boolean.TRUE // i.e. T[RUE]
|
||||
* BooleanUtils.toBooleanObject("false") = Boolean.FALSE
|
||||
* BooleanUtils.toBooleanObject("f") = Boolean.FALSE // i.e. f[alse]
|
||||
* BooleanUtils.toBooleanObject("No") = Boolean.FALSE
|
||||
* BooleanUtils.toBooleanObject("n") = Boolean.FALSE // i.e. n[o]
|
||||
* BooleanUtils.toBooleanObject("on") = Boolean.TRUE
|
||||
* BooleanUtils.toBooleanObject("ON") = Boolean.TRUE
|
||||
* BooleanUtils.toBooleanObject("off") = Boolean.FALSE
|
||||
* BooleanUtils.toBooleanObject("oFf") = Boolean.FALSE
|
||||
* BooleanUtils.toBooleanObject("yes") = Boolean.TRUE
|
||||
* BooleanUtils.toBooleanObject("Y") = Boolean.TRUE // i.e. Y[ES]
|
||||
* BooleanUtils.toBooleanObject("blue") = null
|
||||
* </pre>
|
||||
*
|
||||
* @param str the String to check
|
||||
* @param str the String to check; upper and lower case are treated as the same
|
||||
* @return the Boolean value of the string, {@code null} if no match or {@code null} input
|
||||
*/
|
||||
public static Boolean toBooleanObject(final String str) {
|
||||
|
@ -669,13 +676,13 @@ public class BooleanUtils {
|
|||
/**
|
||||
* <p>Converts a String to a boolean (optimised for performance).</p>
|
||||
*
|
||||
* <p>{@code 'true'}, {@code 'on'} or {@code 'yes'}
|
||||
* <p>{@code 'true'}, {@code 'on'}, {@code 'y'}, {@code 't'} or {@code 'yes'}
|
||||
* (case insensitive) will return {@code true}. Otherwise,
|
||||
* {@code false} is returned.</p>
|
||||
*
|
||||
* <p>This method performs 4 times faster (JDK1.4) than
|
||||
* {@code Boolean.valueOf(String)}. However, this method accepts
|
||||
* 'on' and 'yes' as true values.
|
||||
* 'on' and 'yes', 't', 'y' as true values.
|
||||
*
|
||||
* <pre>
|
||||
* BooleanUtils.toBoolean(null) = false
|
||||
|
@ -686,6 +693,10 @@ public class BooleanUtils {
|
|||
* BooleanUtils.toBoolean("yes") = true
|
||||
* BooleanUtils.toBoolean("false") = false
|
||||
* BooleanUtils.toBoolean("x gti") = false
|
||||
* BooleanUtils.toBooleanObject("y") = true
|
||||
* BooleanUtils.toBooleanObject("n") = false
|
||||
* BooleanUtils.toBooleanObject("t") = true
|
||||
* BooleanUtils.toBooleanObject("f") = false
|
||||
* </pre>
|
||||
*
|
||||
* @param str the String to check
|
||||
|
|
|
@ -272,13 +272,13 @@ public class BooleanUtilsTest {
|
|||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("TruE"));
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("TruE"));
|
||||
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("y"));
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("y")); // yes
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("Y"));
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("t"));
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("t")); // true
|
||||
assertEquals(Boolean.TRUE, BooleanUtils.toBooleanObject("T"));
|
||||
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject("f"));
|
||||
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject("f")); // false
|
||||
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject("F"));
|
||||
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject("n"));
|
||||
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject("n")); // No
|
||||
assertEquals(Boolean.FALSE, BooleanUtils.toBooleanObject("N"));
|
||||
assertEquals(null, BooleanUtils.toBooleanObject("z"));
|
||||
|
||||
|
|
Loading…
Reference in New Issue