cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r602668 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/StringUtils.java
Date Sun, 09 Dec 2007 13:02:47 GMT
Author: aadamchik
Date: Sun Dec  9 05:02:45 2007
New Revision: 602668

URL: http://svn.apache.org/viewvc?rev=602668&view=rev
Log:
no change - reformatting code to match the rest of Cayenne

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/StringUtils.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/StringUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/StringUtils.java?rev=602668&r1=602667&r2=602668&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/StringUtils.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/StringUtils.java
Sun Dec  9 05:02:45 2007
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.gen;
 
 import org.apache.cayenne.project.validator.MappingNamesHelper;
@@ -30,30 +29,25 @@
  */
 public class StringUtils {
 
-    private static StringUtils sharedInstance = null;
-    
-    public static StringUtils getInstance()
-    {
-        if (null == sharedInstance)
-        {
+    private static StringUtils sharedInstance;
+
+    public static StringUtils getInstance() {
+        if (null == sharedInstance) {
             sharedInstance = new StringUtils();
         }
-        
+
         return sharedInstance;
     }
-    
-    public StringUtils()
-    {
-        super();
-    }
-    
+
     /**
-     * Prepends underscore to variable name if necessary to remove conflict with reserved
keywords.
+     * Prepends underscore to variable name if necessary to remove conflict with reserved
+     * keywords.
      */
     public String formatVariableName(String variableName) {
         if (MappingNamesHelper.getInstance().isReservedJavaKeyword(variableName)) {
             return "_" + variableName;
-        } else {
+        }
+        else {
             return variableName;
         }
     }
@@ -63,34 +57,34 @@
      * 
      * @since 1.2
      */
-   public String stripPackageName(String aString)
-   {
-       if (aString == null || aString.length() == 0)
-           return aString;
-
-       int lastDot = aString.lastIndexOf('.');
-       
-       if ((-1 == lastDot) || ((aString.length() - 1) == lastDot) )  return aString;
-
-       return aString.substring(lastDot + 1);
-   }
-
-   /**
-    * Removes base name, leaving package name.
-    * 
-    * @since 1.2
-    */
-  public String stripClass(String aString)
-  {
-      if (aString == null || aString.length() == 0)
-          return aString;
-
-      int lastDot = aString.lastIndexOf('.');
-      
-      if (-1 == lastDot)  return "";
-      
-      return aString.substring(0, lastDot);
-  }
+    public String stripPackageName(String aString) {
+        if (aString == null || aString.length() == 0)
+            return aString;
+
+        int lastDot = aString.lastIndexOf('.');
+
+        if ((-1 == lastDot) || ((aString.length() - 1) == lastDot))
+            return aString;
+
+        return aString.substring(lastDot + 1);
+    }
+
+    /**
+     * Removes base name, leaving package name.
+     * 
+     * @since 1.2
+     */
+    public String stripClass(String aString) {
+        if (aString == null || aString.length() == 0)
+            return aString;
+
+        int lastDot = aString.lastIndexOf('.');
+
+        if (-1 == lastDot)
+            return "";
+
+        return aString.substring(0, lastDot);
+    }
 
     /**
      * Capitalizes the first letter of the property name.
@@ -104,21 +98,20 @@
         char c = Character.toUpperCase(name.charAt(0));
         return (name.length() == 1) ? Character.toString(c) : c + name.substring(1);
     }
-    
+
     /**
      * Returns string with lowercased first letter
      * 
      * @since 1.2
      */
-   public static String uncapitalized(String aString)
-   {
-       if (aString == null || aString.length() == 0)
-           return aString;
-
-       char c = Character.toLowerCase(aString.charAt(0));
-       return (aString.length() == 1) ? Character.toString(c) : c + aString.substring(1);
-   }
-   
+    public static String uncapitalized(String aString) {
+        if (aString == null || aString.length() == 0)
+            return aString;
+
+        char c = Character.toLowerCase(aString.charAt(0));
+        return (aString.length() == 1) ? Character.toString(c) : c + aString.substring(1);
+    }
+
     /**
      * Converts property name to Java constants naming convention.
      * 



Mime
View raw message