Add BooleanUtils.booleanValues().
Add BooleanUtils.primitiveValues(). Handy for tools and tests. Make next release version 3.12.0.
This commit is contained in:
parent
a3e5a0134e
commit
b2e7374bfb
8
pom.xml
8
pom.xml
|
@ -26,7 +26,7 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12-SNAPSHOT</version>
|
||||
<version>3.12.0-SNAPSHOT</version>
|
||||
<name>Apache Commons Lang</name>
|
||||
|
||||
<inceptionYear>2001</inceptionYear>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<connection>scm:git:http://gitbox.apache.org/repos/asf/commons-lang.git</connection>
|
||||
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/commons-lang.git</developerConnection>
|
||||
<url>https://gitbox.apache.org/repos/asf?p=commons-lang.git</url>
|
||||
<tag>commons-lang-3.12</tag>
|
||||
<tag>commons-lang-3.12.0</tag>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
|
@ -587,7 +587,7 @@
|
|||
<commons.packageId>lang3</commons.packageId>
|
||||
<commons.module.name>org.apache.commons.lang3</commons.module.name>
|
||||
<!-- Current 3.x release series -->
|
||||
<commons.release.version>3.12</commons.release.version>
|
||||
<commons.release.version>3.12.0</commons.release.version>
|
||||
<commons.release.desc>(Java 8+)</commons.release.desc>
|
||||
<!-- Previous 2.x release series -->
|
||||
<commons.release.2.version>2.6</commons.release.2.version>
|
||||
|
@ -624,7 +624,7 @@
|
|||
<commons.japicmp.version>0.14.3</commons.japicmp.version>
|
||||
|
||||
<!-- Commons Release Plugin -->
|
||||
<commons.bc.version>3.10</commons.bc.version>
|
||||
<commons.bc.version>3.11</commons.bc.version>
|
||||
<commons.rc.version>RC2</commons.rc.version>
|
||||
<commons.release.isDistModule>true</commons.release.isDistModule>
|
||||
<commons.distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/lang</commons.distSvnStagingUrl>
|
||||
|
|
|
@ -45,11 +45,14 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
</properties>
|
||||
<body>
|
||||
|
||||
<release version="3.12" date="2020-MM-DD" description="New features and bug fixes.">
|
||||
<release version="3.12.0" date="2020-MM-DD" description="New features and bug fixes.">
|
||||
<!-- FIXES -->
|
||||
<action issue="LANG-1592" type="fix" dev="aherbert" due-to="Huang Pingcai, Alex Herbert">Correct implementation of RandomUtils.nextLong(long, long)</action>
|
||||
<action issue="LANG-1600" type="fix" dev="ggregory" due-to="Michael F">Restore handling of collections for non-JSON ToStringStyle #610.</action>
|
||||
<action type="fix" dev="ggregory" due-to="iamchao1129">ContextedException Javadoc add missing semicolon #581.</action>
|
||||
<!-- ADDS -->
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add BooleanUtils.booleanValues().</action>
|
||||
<action type="add" dev="ggregory" due-to="Gary Gregory">Add BooleanUtils.primitiveValues().</action>
|
||||
<!-- UPDATES -->
|
||||
<action issue="LANG-1606" type="update" dev="sebb" due-to="Rustem Galiev">StringUtils.countMatches - clarify Javadoc.</action>
|
||||
<action issue="LANG-1591" type="update" dev="kinow" due-to="bhawna94">Remove redundant argument from substring call.</action>
|
||||
|
|
|
@ -99,6 +99,15 @@ public static Boolean and(final Boolean... array) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new array of possible values (like an enum would).
|
||||
* @return a new array of possible values (like an enum would).
|
||||
* @since 3.12.0
|
||||
*/
|
||||
public static Boolean[] booleanValues() {
|
||||
return new Boolean[] {Boolean.FALSE, Boolean.TRUE};
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Compares two {@code boolean} values. This is the same functionality as provided in Java 7.</p>
|
||||
*
|
||||
|
@ -280,6 +289,15 @@ public static Boolean or(final Boolean... array) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new array of possible values (like an enum would).
|
||||
* @return a new array of possible values (like an enum would).
|
||||
* @since 3.12.0
|
||||
*/
|
||||
public static boolean[] primitiveValues() {
|
||||
return new boolean[] {false, true};
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Converts a Boolean to a boolean handling {@code null}
|
||||
* by returning {@code false}.</p>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
@ -26,6 +27,7 @@
|
|||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -34,6 +36,13 @@
|
|||
*/
|
||||
public class BooleanUtilsTest {
|
||||
|
||||
@Test
|
||||
public void test_booleanValues() {
|
||||
final Boolean[] expected = new Boolean[] {false, true};
|
||||
Arrays.sort(expected);
|
||||
assertArrayEquals(expected, BooleanUtils.booleanValues());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isFalse_Boolean() {
|
||||
assertFalse(BooleanUtils.isFalse(Boolean.TRUE));
|
||||
|
@ -69,6 +78,11 @@ public void test_negate_Boolean() {
|
|||
assertSame(Boolean.FALSE, BooleanUtils.negate(Boolean.TRUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_primitiveValues() {
|
||||
assertArrayEquals(new boolean[] {false, true}, BooleanUtils.primitiveValues());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_toBoolean_Boolean() {
|
||||
assertTrue(BooleanUtils.toBoolean(Boolean.TRUE));
|
||||
|
|
Loading…
Reference in New Issue