myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r698196 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/webapp/ tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/
Date Tue, 23 Sep 2008 14:49:19 GMT
Author: bommel
Date: Tue Sep 23 07:49:18 2008
New Revision: 698196

URL: http://svn.apache.org/viewvc?rev=698196&view=rev
Log:
minor performance improvement

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequest.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequest.java?rev=698196&r1=698195&r2=698196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequest.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequest.java
Tue Sep 23 07:49:18 2008
@@ -118,16 +118,13 @@
           } else if (inStock instanceof String[]) { // double (or more) parameter
             String[] oldValues = (String[]) inStock;
             String[] values = new String[oldValues.length + 1];
-            int i = 0;
-            for (; i < oldValues.length; i++) {
-              values[i] = oldValues[i];
-            }
+            System.arraycopy(oldValues, 0, values, 0, oldValues.length);
             try {
               // TODO: enable configuration of  'accept-charset'
-              values[i] = item.getString(FORM_ACCEPT_CHARSET);
+              values[oldValues.length] = item.getString(FORM_ACCEPT_CHARSET);
             } catch (UnsupportedEncodingException e) {
               LOG.error("Caught: " + e.getMessage(), e);
-              values[i] = item.getString();
+              values[oldValues.length] = item.getString();
             }
             parameters.put(key, values);
           } else {

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg?rev=698196&r1=698195&r2=698196&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
(original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
Tue Sep 23 07:49:18 2008
@@ -61,11 +61,11 @@
 
   <if(tagInfo.properties)>
   @Override
-  protected void setProperties(UIComponent uiComponent) {
+  protected void setProperties(final UIComponent uiComponent) {
     super.setProperties(uiComponent);
-    <tagInfo.componentClassName> component = (<tagInfo.componentClassName>) uiComponent;
-    FacesContext context = FacesContext.getCurrentInstance();
-    Application application = context.getApplication();
+    final <tagInfo.componentClassName> component = (<tagInfo.componentClassName>)
uiComponent;
+    final FacesContext context = FacesContext.getCurrentInstance();
+    final Application application = context.getApplication();
     <tagInfo.properties:{ p | <p:(p.template)()>}; separator="\n">
 
   }
@@ -76,11 +76,11 @@
   @Override
   public int doEndTag() throws javax.servlet.jsp.JspException {
     if (!isBodyContentEmpty()) {
-      String bodyContentStr = getBodyContentStr();
+      final String bodyContentStr = getBodyContentStr();
       if (isValueReference(bodyContentStr)) {
         getComponentInstance().setValueBinding("<tagInfo.bodyContent.name>", getFacesContext().getApplication().createValueBinding(bodyContentStr));
       } else {
-        <tagInfo.componentClassName> component = (<tagInfo.componentClassName>)
getComponentInstance();
+        final <tagInfo.componentClassName> component = (<tagInfo.componentClassName>)
getComponentInstance();
         component.set<tagInfo.bodyContent.upperCamelCaseName>(bodyContentStr);
       }
     }
@@ -110,7 +110,7 @@
   return <it.propertyName>;
 }
 
-public void set<it.upperCamelCaseName>(String <it.propertyName>) {
+public void set<it.upperCamelCaseName>(final String <it.propertyName>) {
   this.<it.propertyName> = <it.propertyName>;
 }
 
@@ -270,7 +270,7 @@
 >>
 
 createMethodBinding(it) ::= <<
-javax.faces.el.MethodBinding methodBinding = application.createMethodBinding(<it.propertyName>,
+final javax.faces.el.MethodBinding methodBinding = application.createMethodBinding(<it.propertyName>,
     new Class[] { <first(it.methodSignature):{ n | <n>.class }><rest(it.methodSignature):{
n | , <n>.class}>} );
 >>
 

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg?rev=698196&r1=698195&r2=698196&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg
(original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg
Tue Sep 23 07:49:18 2008
@@ -61,11 +61,11 @@
 
   <if(tagInfo.properties)>
   @Override
-  protected void setProperties(UIComponent uiComponent) {
+  protected void setProperties(final UIComponent uiComponent) {
     super.setProperties(uiComponent);
-    <tagInfo.componentClassName> component = (<tagInfo.componentClassName>) uiComponent;
-    FacesContext context = FacesContext.getCurrentInstance();
-    Application application = context.getApplication();
+    final <tagInfo.componentClassName> component = (<tagInfo.componentClassName>)
uiComponent;
+    final FacesContext context = FacesContext.getCurrentInstance();
+    final Application application = context.getApplication();
     <tagInfo.properties:{ p | <p:(p.template)()>}; separator="\n">
   }
 
@@ -75,8 +75,8 @@
   @Override
   public int doEndTag() throws javax.servlet.jsp.JspException {
     if (!isBodyContentEmpty()) {
-      String bodyContentStr = getBodyContentStr();
-      <tagInfo.componentClassName> component = (<tagInfo.componentClassName>)
getComponentInstance();
+      final String bodyContentStr = getBodyContentStr();
+      final <tagInfo.componentClassName> component = (<tagInfo.componentClassName>)
getComponentInstance();
       component.set<tagInfo.bodyContent.upperCamelCaseName>(bodyContentStr);
     }
     return super.doEndTag();
@@ -106,7 +106,7 @@
   return <it.propertyName>;
 }
 
-public void set<it.upperCamelCaseName>(String <it.propertyName>) {
+public void set<it.upperCamelCaseName>(final String <it.propertyName>) {
   this.<it.propertyName> = <it.propertyName>;
 }
 <else>
@@ -115,7 +115,7 @@
   return <it.propertyName>;
 }
 
-public void set<it.upperCamelCaseName>(javax.el.MethodExpression <it.propertyName>)
{
+public void set<it.upperCamelCaseName>(final javax.el.MethodExpression <it.propertyName>)
{
   this.<it.propertyName> = <it.propertyName>;
 }
 <else>
@@ -123,7 +123,7 @@
   return <it.propertyName>;
 }
 
-public void set<it.upperCamelCaseName>(javax.el.ValueExpression <it.propertyName>)
{
+public void set<it.upperCamelCaseName>(final javax.el.ValueExpression <it.propertyName>)
{
   this.<it.propertyName> = <it.propertyName>;
 }
 <endif>
@@ -289,7 +289,7 @@
 >>
 
 createMethodBinding(it) ::= <<
-javax.faces.el.MethodBinding methodBinding = application.createMethodBinding(<it.propertyName>.getExpressionString(),
+final javax.faces.el.MethodBinding methodBinding = application.createMethodBinding(<it.propertyName>.getExpressionString(),
     new Class[] { <first(it.methodSignature):{ n | <n>.class }><rest(it.methodSignature):{
n | , <n>.class}>} );
 >>
 



Mime
View raw message