Author: kentam Date: Wed Jan 5 10:22:12 2005 New Revision: 124238 URL: http://svn.apache.org/viewcvs?view=rev&rev=124238 Log: Fixed a problem where the generated control bean does not compile if a control method returns a primitive type. In the generated bean class, a control method's return value needs to be passed to the postInvoke() method as an object. This fix will ensure return values of a primitive type are wrapped in the corresponding wrapper class first.
Contributor: Hoi Lam Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm?view=diff&rev=124238&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm&r1=124237&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm&r2=124238 ============================================================================== --- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm (original) +++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlBean.vm Wed Jan 5 10:22:12 2005 @@ -155,10 +155,10 @@ } finally { - #if ($returnType != "void") - Object rv = retval; - #else + #if ($returnType == "void") Object rv = null; + #else + Object rv = #wrapPrimitive("retval" $returnType); #end #if ($operation.interceptorServiceNames.size() == 0) Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm?view=diff&rev=124238&p1=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm&r1=124237&p2=incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm&r2=124238 ============================================================================== --- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm (original) +++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/ControlMacros.vm Wed Jan 5 10:22:12 2005 @@ -29,6 +29,9 @@ ## A simple helper macro that converts a primitive type to the equivalent object ## #macro (toObject $type)#if ($type == "int")Integer#elseif ($type == "long")Long#elseif ($type == "boolean")Boolean#elseif ($type == "byte")Byte#elseif ($type == "short")Short#elseif ($type == "char")Character#elseif ($type == "float")Float#elseif ($type == "double")Double#else${type}#end#end +## A simple helper that wraps a primitive variable in its corresponding wrapper class +#macro (wrapPrimitive $varName $varType)#if ($varType == "int")new Integer($varName)#elseif ($varType == "long")new Long($varName)#elseif ($varType == "boolean")new Boolean($varName)#elseif ($varType == "byte")new Byte($varName)#elseif ($varType == "short")new Short($varName)#elseif ($varType == "char")new Character($varName)#elseif ($varType == "float")new Float($varName)#elseif ($varType == "double")new Double($varName)#else$varName#end +#end ## ## A simple helper macro that converts a object type to the equivalent primitive ##
