[Schmitzm-commits] r1881 - trunk/schmitzm-core/src/main/java/de/schmitzm/lang
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Wed Feb 29 02:46:20 CET 2012
Author: alfonx
Date: 2012-02-29 02:46:20 +0100 (Wed, 29 Feb 2012)
New Revision: 1881
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
Log:
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java 2012-02-29 01:40:36 UTC (rev 1880)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java 2012-02-29 01:46:20 UTC (rev 1881)
@@ -2025,6 +2025,13 @@
* Interpretiert einen {@link String} zu einem {@link boolean} mit default <code>null</code>.
*/
public static Boolean parseStringDefaultNull(String str) {
+ return parseStringDefaultNull(str, true);
+ }
+
+ /**
+ * Interpretiert einen {@link String} zu einem {@link boolean} mit default <code>null</code>.
+ */
+ public static Boolean parseStringDefaultNull(String str, boolean lax) {
if (str == null)
return null;
String trimmedLowcase = removeWhitespacesToEmpty(str.toLowerCase()).trim();
@@ -2042,8 +2049,6 @@
return false;
if (trimmedLowcase.startsWith("wrong"))
return false;
- if (trimmedLowcase.startsWith("0"))
- return false;
if (trimmedLowcase.startsWith("yes"))
return true;
if (trimmedLowcase.startsWith("ja"))
@@ -2056,8 +2061,6 @@
return true;
if (trimmedLowcase.equals("j"))
return true;
- if (trimmedLowcase.matches("^1[^\\s]?"))
- return true;
if (trimmedLowcase.startsWith("true"))
return true;
if (trimmedLowcase.startsWith("richtig"))
@@ -2070,8 +2073,15 @@
return true;
if (trimmedLowcase.contains("wahr"))
return true;
- if (trimmedLowcase.contains("existie"))
- return true;
+
+ if (lax) {
+ if (trimmedLowcase.contains("existie"))
+ return true;
+ if (trimmedLowcase.matches("^1[^\\s]?"))
+ return true;
+ if (trimmedLowcase.startsWith("0"))
+ return false;
+ }
// Default
return null;
}
More information about the Schmitzm-commits
mailing list