Skip to content

Commit

Permalink
1.add static field
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklaux committed Nov 24, 2021
1 parent 9bc98f4 commit b49db92
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/igeeksky/xtool/core/lang/BooleanUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @since 0.0.4 2021-10-21
*/
public class BooleanUtils {
public static final String TRUE = "true";
public static final String FALSE = "false";

private BooleanUtils() {
}
Expand All @@ -28,7 +30,7 @@ public static Boolean toBoolean(Object original) {

String temp = StringUtils.trimToNull(original.toString());
if (temp != null) {
if (temp.equalsIgnoreCase("true") || temp.equalsIgnoreCase("false")) {
if (temp.equalsIgnoreCase(TRUE) || temp.equalsIgnoreCase(FALSE)) {
return Boolean.valueOf(temp);
}
throw new IllegalArgumentException("For input string: \"" + temp + "\"");
Expand Down

0 comments on commit b49db92

Please sign in to comment.