db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Re: [PATCH TORQUE-3.1.1] Name Boolean/boolan getters correctly for generated objects
Date Mon, 23 Aug 2004 02:12:02 GMT
Henning,

I like what this patch does, but I have a couple of concerns.  Firstly I 
think the fact that this would result in Torque 3.1.1 generating 
different method names to Torque 3.1 (at least for boolean columns) is 
not something users would be expecting.  Secondly, from the perspective 
of a Turbine user, have/will the mapper methods in ParameterParser, et 
al, been/be updated?  I know that my Turbine applications would fail if 
this patch is applied and I regenerate my om.  IMHO it would be more 
appropriate to introduce such a change in Torque 3.2.  A more acceptable 
alternative would be if the generated code provides both the current 
"get" methods (perhaps marking them as deprecated) and the new "is 
methods.  It would be nice to know that the Turbine ParameterParser was 
going to sync up with this change in some future release.

A few additional minor points:
1. I have highlighted a change below that I think you may like to 
reverse (an erroneous replace I think).
2. I have also highlighted an instance where you introduce an space 
character after method names in the generated code (I only highlighted 
one of these but there are more).  While the generated code is not all 
that attractive there is no reason to make it worse.  This was 
highlighted to me by comparing changes to the generated code after 
applying your patch - it results in a whole bunch of changes that are 
just the introduction of a space.
3. The Object.vm changes need to be replicated for ObjectWithManager.vm

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



Henning Schmiedehausen wrote:

>Hi Scott, 
>
>I know that you are close to the 3.1.1 release of Torque but I would
>really want you to consider the attached patch. It changes the
>generation of the Getter and Setter methods in the Object.vm and Peer.vm
>to ask the Column. The column object gets two additional getters, called
>getGetterName() and getSetterName(). The getSetterName() just returns
>"set$Property", but the getGetterName() returns "is$property" if the
>property value is either boolean or a java.lang.Boolean.
>
>This is in accordance to the Sun Java Beans rules and I would really
>like to see this patch in the 3.1.1 release.
>
>	Regards
>		Henning
>
>  
>
<snip/>

>Index: src/templates/om/Object.vm
>===================================================================
>RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Object.vm,v
>retrieving revision 1.7.2.3
>diff -u -r1.7.2.3 Object.vm
>--- src/templates/om/Object.vm	14 Aug 2004 12:02:33 -0000	1.7.2.3
>+++ src/templates/om/Object.vm	20 Aug 2004 23:45:29 -0000
>@@ -121,7 +121,7 @@
>      *
>      * @return $cjtype
>      */
>-    public $cjtype get${cfc}()
>+    public $cjtype ${col.GetterName} ()
>  
>
---------------------------------------^ Why the space here?

>     {
>         return $clo;
>     }
>@@ -143,7 +143,7 @@
>      *
>      * @param v new value
>      */
>-    public void set${cfc}($cjtype v) $throwsClause
>+    public void $col.SetterName ($cjtype v) $throwsClause
>     {
>     #if (($cjtype == "NumberKey") || ($cjtype == "StringKey") || ($cjtype == "DateKey"))
>         if (v != null && v.getValue() == null)
>  
>
<snip/>

>@@ -501,7 +501,7 @@
>     public void add${relColMs}($className l) throws TorqueException
>     {
>         get${relCol}().add(l);
>-        l.set${table.JavaName}${suffix}(($table.JavaName) this);
>+        l.${table.SetterName}${suffix}(($table.JavaName) this);
>  
>
-------------^^^^^^^^^^^^^^^^^^ You most likely don't want this change.

>     }
> 
>     /**
>  
>
<snip/>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message