[jboss-cvs] JBossAS SVN: r58666 - trunk/server/src/main/org/jboss/metadata

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 24 03:11:13 EST 2006


Author: alex.loubyansky at jboss.com
Date: 2006-11-24 03:11:11 -0500 (Fri, 24 Nov 2006)
New Revision: 58666

Modified:
   trunk/server/src/main/org/jboss/metadata/MethodMetaData.java
Log:
fixed method params

Modified: trunk/server/src/main/org/jboss/metadata/MethodMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/MethodMetaData.java	2006-11-24 00:52:12 UTC (rev 58665)
+++ trunk/server/src/main/org/jboss/metadata/MethodMetaData.java	2006-11-24 08:11:11 UTC (rev 58666)
@@ -21,7 +21,6 @@
 */
 package org.jboss.metadata;
 
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.HashSet;
@@ -67,8 +66,6 @@
    public static String LOCAL_TYPE = "Local";
    public static String SERVICE_ENDPOINT_TYPE = "ServiceEndpoint";
 
-   private static final ArrayList EMPTY_PARAM_LIST = new ArrayList();
-
    // Attributes ----------------------------------------------------
    /** The method-name element contains a name of an enterprise bean method,
     * or the asterisk (*) character. The asterisk is used when the element
@@ -96,7 +93,6 @@
    /** One of: InvocationType
     */
    private InvocationType methodType = null;
-   private boolean param = false;
    /** The unchecked element specifies that a method is not checked for
     * authorization by the container prior to invocation of the method.
     * Used in: method-permission
@@ -111,7 +107,7 @@
    /** The method-params element contains a list of the fully-qualified Java
     * type names of the method parameters.
     */
-   private ArrayList paramList = EMPTY_PARAM_LIST;
+   private String[] params = new String[0];
    /** The trans-attribute element specifies how the container must manage
     * the transaction boundaries when delegating a method invocation to an
     * enterprise bean’s business method.
@@ -248,24 +244,15 @@
 
    public boolean isParamGiven()
    {
-      return param;
+      return params.length > 0;
    }
 
-   /** The method param type names.
-    * @return
-    */ 
-   public Iterator getParams()
-   {
-      return paramList.iterator();
-   }
-   /** The 
+   /** The
     * 
     * @return An array of the method parameter type names
     */ 
    public String[] getMethodParams()
    {
-      String[] params = new String[paramList.size()];
-      paramList.toArray(params);
       return params;
    }
 
@@ -340,12 +327,17 @@
 
    public void addParam(String param)
    {
-      if(paramList == null)
+      if(params == null)
       {
-         this.param = true;
-         paramList = new ArrayList();
+         params = new String[1];
       }
-      paramList.add(param);
+      else
+      {
+         String[] tmp = params;
+         params = new String[params.length + 1];
+         System.arraycopy(tmp, 0, params, 0, tmp.length);
+      }
+      params[params.length - 1] = param;
    }
 
    /**
@@ -366,12 +358,10 @@
       Element paramsElement = getOptionalChild(element, "method-params");
       if (paramsElement != null)
       {
-         param = true;
-         paramList = new ArrayList();
          Iterator paramsIterator = getChildrenByTagName(paramsElement, "method-param");
          while (paramsIterator.hasNext())
          {
-            paramList.add(getElementContent((Element) paramsIterator.next()));
+            addParam(getElementContent((Element) paramsIterator.next()));
          }
       }
    }
@@ -400,9 +390,9 @@
 
    private boolean sameParams(String[] arg)
    {
-      if (arg.length != paramList.size()) return false;
+      if (arg.length != params.length) return false;
       for (int i = 0; i < arg.length; i++)
-         if (!arg[i].equals(paramList.get(i)))
+         if (!arg[i].equals(params[i]))
             return false;
       return true;
    }




More information about the jboss-cvs-commits mailing list