[Schmitzm-commits] r1503 - trunk/schmitzm-core/src/main/java/de/schmitzm/lang

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Feb 25 20:34:02 CET 2011


Author: alfonx
Date: 2011-02-25 20:34:01 +0100 (Fri, 25 Feb 2011)
New Revision: 1503

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	2011-02-17 13:27:28 UTC (rev 1502)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/LangUtil.java	2011-02-25 19:34:01 UTC (rev 1503)
@@ -1627,6 +1627,27 @@
 
 	/**
 	 * Interpretiert einen {@link String} zu einem {@link boolean} mit default
+	 * <code>null</code>.
+	 */
+	public static Boolean parseStringDefaultNull(String str) {
+		if (str == null)
+			return null;
+		String trimmedLowcase = str.toLowerCase().trim();
+		if (trimmedLowcase.startsWith("n"))
+			return false;
+		if (trimmedLowcase.startsWith("0"))
+			return false;
+		if (trimmedLowcase.startsWith("y"))
+			return true;
+		if (trimmedLowcase.startsWith("j"))
+			return true;
+		if (trimmedLowcase.startsWith("1"))
+			return true;
+		return null;
+	}
+
+	/**
+	 * Interpretiert einen {@link String} zu einem {@link boolean} mit default
 	 * <code>false</code>.
 	 */
 	public static boolean parseStringDefaultFalse(String str) {



More information about the Schmitzm-commits mailing list