db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thoralf Rickert" <thoralf.rick...@cadooz.de>
Subject Torque with Java5 features
Date Fri, 25 Nov 2005 09:51:21 GMT
Hi!

I'm not sure, if this feature was discussed already on this list, but
how big is the chance, that torque supports the Java5 features, like
generics, in a future version? I know that this means a lot of work and
much trouble with users, who aren't able to use Java5 because of some
restrictions or what ever. But it has some very useful addons. For
example a generated doSelect could return a List<TableA>. That makes
runtime errors - because of wrong class casts - obsolete.

After Sun's launch of the Java5 version, I had changed most of the class
generation templates in torque 3.1 (object,peer,map) to use this
features in our whole application without any breakage (til
BasePeer...). That tooks me 4-5 hours and wasn't really complicated. But
it's practically a branch, because older Java compiler aren't able to
compile this generated classes. And I know it's not useful to maintain
two source tree for pre Java5 and Java5.

I think it could be possible to create templates that are able to
generate preJava5 and Java5 version by using a switch in the
configuration. For example a switch called torque.java5, which could be
true or false could be used to output the best java source code. For
example:

public static java.util.List#if($torque.java5)<${table.JavaName}>#end
    doSelect(Criteria criteria) throws org.apache.torque.TorqueException
{
  return populateObjects(doSelectVillageRecords(criteria));
}

It's not nice, but it could work. The other part (converting the
generator and the runtime libraries) is another problem... 

But for now I'm just asking, if this is on your plan?

bye
Thoralf




---------------------------------------------------------------------
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