Author: simoneg
Date: Mon Nov 16 21:51:25 2009
New Revision: 880982

URL: http://svn.apache.org/viewvc?rev=880982&view=rev
Log:
LABS-221 : fixes on LinkHelper

Modified:
    
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/LinkHelper.java

Modified: 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/LinkHelper.java
URL: 
http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/LinkHelper.java?rev=880982&r1=880981&r2=880982&view=diff
==============================================================================
--- 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/LinkHelper.java
 (original)
+++ 
labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/LinkHelper.java
 Mon Nov 16 21:51:25 2009
@@ -45,7 +45,7 @@
                this(method.getName(), 
GenericClass.toRawClasses(method.getParameterTypes()));
        }
        
-       public LinkHelper(String methodName, Class<?>[] parameters) {
+       public LinkHelper(String methodName, Class<?>... parameters) {
                methodName = linkNameFromMethodName(methodName);
                this.baseMethod = methodName;
                if (parameters == null) {
@@ -65,6 +65,7 @@
                if (params != null) {
                        if (params.length > converters.length) throw new 
MagmaException("Incorrect number of parameters for link to {0}, expecting {1} 
got {2}", this.baseMethod, this.converters.length, params.length);
                        for (int i = 0; i < params.length; i++) {
+                               ret.append(WebHandler.paramSeparator);
                                Object param = params[i];
                                if (param == null) {
                                        // TODO is this the global null value? 
See LABS-175
@@ -104,10 +105,11 @@
                
                // search for name
                List<MethodDef> allMethods = new ArrayList<MethodDef>();
-               allMethods.addAll(gc.findAllMethods("handle" + 
this.baseMethod));
-               allMethods.addAll(gc.findAllMethods("do" + this.baseMethod));
-               allMethods.addAll(gc.findAllMethods("hidden" + 
this.baseMethod));
-               if (allMethods.size() == 0) throw new MagmaException("Cannot 
find a method do{0}, handle{0} or hidden{0} for link in class {1}", 
this.baseMethod, handlerClass);
+               String upcasedMethod = 
Character.toUpperCase(this.baseMethod.charAt(0)) + this.baseMethod.substring(1);
+               allMethods.addAll(gc.findAllMethods("handle" + upcasedMethod));
+               allMethods.addAll(gc.findAllMethods("do" + upcasedMethod));
+               allMethods.addAll(gc.findAllMethods("hidden" + upcasedMethod));
+               if (allMethods.size() == 0) throw new MagmaException("Cannot 
find a method do{0}, handle{0} or hidden{0} for link in class {1}", 
upcasedMethod, handlerClass);
                
                // Check parameters
                Method found = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to