geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r564608 - in /geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean: GAttributeInfo.java GBeanInfo.java GConstructorInfo.java GOperationInfo.java GReferenceInfo.java
Date Fri, 10 Aug 2007 14:43:18 GMT
Author: jaydm
Date: Fri Aug 10 07:43:14 2007
New Revision: 564608

URL: http://svn.apache.org/viewvc?view=rev&rev=564608
Log:
Changed simple string appending to using StringBuilder to increase performance
as suggested by Jarek (thanks for the suggestion)

Modified:
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GAttributeInfo.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GConstructorInfo.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
    geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GReferenceInfo.java

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GAttributeInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GAttributeInfo.java?view=diff&rev=564608&r1=564607&r2=564608
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GAttributeInfo.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GAttributeInfo.java
Fri Aug 10 07:43:14 2007
@@ -133,19 +133,19 @@
     }
 
     public String toXML(AbstractName abstractName) {
-        String xml = "";
-        
-        xml += "<gAttributeInfo ";
-        xml += "name='" + name + "' ";
-        xml += "type='" + type + "' ";
-        xml += "persistent='" + persistent + "' ";
-        xml += "manageable='" + manageable + "' ";
-        xml += "readable='" + readable + "' ";
-        xml += "writable='" + writable + "' ";
-        xml += ">";
-        
-        xml += "<getterName>" + getterName + "</getterName>";
-        xml += "<setterName>" + setterName + "</setterName>";
+        StringBuilder xml = new StringBuilder();
+
+        xml.append("<gAttributeInfo ");
+        xml.append("name='" + name + "' ");
+        xml.append("type='" + type + "' ");
+        xml.append("persistent='" + persistent + "' ");
+        xml.append("manageable='" + manageable + "' ");
+        xml.append("readable='" + readable + "' ");
+        xml.append("writable='" + writable + "' ");
+        xml.append(">");
+
+        xml.append("<getterName>" + getterName + "</getterName>");
+        xml.append("<setterName>" + setterName + "</setterName>");
 
         if (readable) {
             try {
@@ -153,18 +153,18 @@
                 if (value != null) {
                     if (value instanceof String[]) {
                         for (String valueString : Arrays.asList((String[]) value))
-                            xml += "<value>" + valueString + "</value>";    
       
+                            xml.append("<value>" + valueString + "</value>");
                     } else {
-                        xml += "<value>" + value + "</value>";
+                        xml.append("<value>" + value + "</value>");
                     }
                 }
             } catch (Exception e) {
-                
+
             }
         }
-        
-        xml += "</gAttributeInfo>";
 
-        return xml;
+        xml.append("</gAttributeInfo>");
+
+        return xml.toString();
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java?view=diff&rev=564608&r1=564607&r2=564608
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
Fri Aug 10 07:43:14 2007
@@ -295,7 +295,7 @@
         priority = GBeanInfo.PRIORITY_NORMAL;
         in.defaultReadObject();
     }
-    
+
     public String toString() {
         StringBuffer result = new StringBuffer("[GBeanInfo:");
         result.append(" id=").append(super.toString());
@@ -316,58 +316,59 @@
         result.append("]");
         return result.toString();
     }
-    
+
     public String toXML(AbstractName abstractName) {
-        String xml = "";
-        
-        xml += "<gBeanInfo ";
-        xml += "id='" + super.toString() + "' ";
-        xml += "sourceClass='" + sourceClass + "' ";
-        xml += "name='" + name + "' ";
-        xml += "className='" + className + "' ";
-        xml += "type='" + j2eeType + "' ";
-        xml += "priority='" + priority + "' ";
-        xml += ">";
-        
-        xml += "<attributes>";
-        
+        StringBuilder xml = new StringBuilder();
+
+        xml.append("<gBeanInfo ");
+        xml.append("id='" + super.toString() + "' ");
+        xml.append("sourceClass='" + sourceClass + "' ");
+        xml.append("name='" + name + "' ");
+        xml.append("className='" + className + "' ");
+        xml.append("type='" + j2eeType + "' ");
+        xml.append("priority='" + priority + "' ");
+        xml.append(">");
+
+        xml.append("<attributes>");
+
         for (Iterator loop = attributes.iterator(); loop.hasNext(); ) {
-            xml += ((GAttributeInfo) loop.next()).toXML(abstractName);
+            xml.append(((GAttributeInfo) loop.next()).toXML(abstractName));
         }
-        
-        xml += "</attributes>";
-        
-        xml += constructor.toXML();
-        
-        xml += "<operations>";
-        
+
+        xml.append("</attributes>");
+
+        xml.append(constructor.toXML());
+
+        xml.append("<operations>");
+
         for (Iterator loop = operations.iterator(); loop.hasNext(); ) {
-            xml += ((GOperationInfo) loop.next()).toXML();
+            xml.append(((GOperationInfo) loop.next()).toXML());
         }
-        
-        xml += "</operations>";
-        
-        xml += "<notifications>";
-        
+
+        xml.append("</operations>");
+
+        xml.append("<notifications>");
+
         // I had expected this to be a set of GNotification Objects
         // but it was just strings
         for (Iterator loop = notifications.iterator(); loop.hasNext(); ) {
             Object note = loop.next();
-            xml += "<notification>" + note + "</notification>";
+
+            xml.append("<notification>" + note + "</notification>");
         }
-        
-        xml += "</notifications>";
-        
-        xml += "<references>";
-        
+
+        xml.append("</notifications>");
+
+        xml.append("<references>");
+
         for (Iterator loop = references.iterator(); loop.hasNext(); ) {
-            xml += ((GReferenceInfo) loop.next()).toXML();
+            xml.append(((GReferenceInfo) loop.next()).toXML());
         }
-        
-        xml += "</references>";
-        
-        xml += "</gBeanInfo>";
-        
-        return xml;
+
+        xml.append("</references>");
+
+        xml.append("</gBeanInfo>");
+
+        return xml.toString();
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GConstructorInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GConstructorInfo.java?view=diff&rev=564608&r1=564607&r2=564608
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GConstructorInfo.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GConstructorInfo.java
Fri Aug 10 07:43:14 2007
@@ -52,20 +52,18 @@
     }
     
     public String toXML() {
-    	String xml = "";
-    	
-    	xml += "<gConstructorInfo>";
-    	
-    	xml += "<attributes>";
+    	StringBuilder xml = new StringBuilder();
     	
+    	xml.append("<gConstructorInfo>");
+    	xml.append("<attributes>");
+
     	for (Iterator loop = attributeNames.iterator(); loop.hasNext(); ) {
-    		xml += "<name>" + loop.next().toString() + "</name>";
+    		xml.append("<name>" + loop.next().toString() + "</name>");
     	}
     	
-    	xml += "</attributes>";
-    	
-    	xml += "</gConstructorInfo>";
+    	xml.append("</attributes>");
+    	xml.append("</gConstructorInfo>");
     	
-    	return xml;
+    	return xml.toString();
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java?view=diff&rev=564608&r1=564607&r2=564608
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GOperationInfo.java
Fri Aug 10 07:43:14 2007
@@ -99,25 +99,25 @@
     public String toString() {
         return "[GOperationInfo: name=" + name + " parameters=" + parameters + " returnType
=" + returnType + "]";
     }
-    
+
     public String toXML() {
-    	String xml = "";
-    	
-    	xml += "<gOperationInfo ";
-    	xml += "name='" + name + "' ";
-    	xml += "returnType='" + returnType + "' ";
-    	xml += ">";
-    	
-    	xml += "<parameters>";
-    	
-    	for (Iterator loop = parameters.iterator(); loop.hasNext(); ) {
-    		xml += "<parameterType>" + loop.next().toString() + "</parameterType>";
-    	}
-    	
-    	xml += "</parameters>";
-    	
-    	xml += "</gOperationInfo>";
-    	
-    	return xml;
+        StringBuilder xml = new StringBuilder();
+
+        xml.append("<gOperationInfo ");
+        xml.append("name='" + name + "' ");
+        xml.append("returnType='" + returnType + "' ");
+        xml.append(">");
+
+        xml.append("<parameters>");
+
+        for (Iterator loop = parameters.iterator(); loop.hasNext(); ) {
+            xml.append("<parameterType>" + loop.next().toString() + "</parameterType>");
+        }
+
+        xml.append("</parameters>");
+
+        xml.append("</gOperationInfo>");
+
+        return xml.toString();
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GReferenceInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GReferenceInfo.java?view=diff&rev=564608&r1=564607&r2=564608
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GReferenceInfo.java
(original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GReferenceInfo.java
Fri Aug 10 07:43:14 2007
@@ -89,16 +89,16 @@
     }
     
     public String toXML() {
-        String xml = "";
+        StringBuilder xml = new StringBuilder();
         
-        xml += "<gReferenceInfo ";
-        xml += "name='" + name + "' ";
-        xml += "referenceType='" + referenceType + "' ";
-        xml += "proxyType='" + proxyType + "' ";
-        xml += "setterName='" + setterName + "' ";
-        xml += "namingSystem='" + nameTypeName + "' ";
-        xml += "/>";
+        xml.append("<gReferenceInfo ");
+        xml.append("name='" + name + "' ");
+        xml.append("referenceType='" + referenceType + "' ");
+        xml.append("proxyType='" + proxyType + "' ");
+        xml.append("setterName='" + setterName + "' ");
+        xml.append("namingSystem='" + nameTypeName + "' ");
+        xml.append("/>");
         
-        return xml;
+        return xml.toString();
     }
 }



Mime
View raw message