[jboss-cvs] JBossAS SVN: r73401 - in projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common: string and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 14 21:12:17 EDT 2008


Author: ALRubinger
Date: 2008-05-14 21:12:17 -0400 (Wed, 14 May 2008)
New Revision: 73401

Added:
   projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/string/
   projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/string/StringUtils.java
Log:
[EJBTHREE-1365] Add a String Utilities class

Added: projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/string/StringUtils.java
===================================================================
--- projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/string/StringUtils.java	                        (rev 0)
+++ projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/string/StringUtils.java	2008-05-15 01:12:17 UTC (rev 73401)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.common.string;
+
+/**
+ * StringUtils
+ * 
+ * A Set of String Manipulation Utilities
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class StringUtils
+{
+
+   /**
+    * Sets the specified String to null if it is empty 
+    * or contains only whitespace
+    * 
+    * @param string
+    */
+   public static final String adjustWhitespaceStringToNull(String string)
+   {
+      // If argument is null, do nothing
+      if (string == null)
+         return null;
+
+      // If no interesting characters are present, set to null
+      if (string.trim().equals(""))
+      {
+         string = null;
+      }
+
+      // Return the String
+      return string;
+   }
+
+}




More information about the jboss-cvs-commits mailing list