Author: tfischer
Date: Sun Jan 29 12:35:08 2006
New Revision: 373352
URL: http://svn.apache.org/viewcvs?rev=373352&view=rev
Log:
Added java5 generics support
Added table description from the schema.xml to the comment of the generated
classes
removed some unnecessary casts from the Peer class
Thanks a lot to Thoralf Rickert for the patch
Modified:
db/torque/generator/trunk/src/conf/build.properties
db/torque/maven-plugin/trunk/plugin.properties
db/torque/templates/trunk/src/templates/om/BaseManager.vm
db/torque/templates/trunk/src/templates/om/ExtensionManager.vm
db/torque/templates/trunk/src/templates/om/ExtensionObject.vm
db/torque/templates/trunk/src/templates/om/ExtensionPeer.vm
db/torque/templates/trunk/src/templates/om/Interface.vm
db/torque/templates/trunk/src/templates/om/MapBuilder.vm
db/torque/templates/trunk/src/templates/om/Object.vm
db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
db/torque/templates/trunk/src/templates/om/Peer.vm
db/torque/templates/trunk/src/templates/om/bean/Bean.vm
db/torque/templates/trunk/src/templates/om/bean/ExtensionBean.vm
db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm
Modified: db/torque/generator/trunk/src/conf/build.properties
URL:
http://svn.apache.org/viewcvs/db/torque/generator/trunk/src/conf/build.properties?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/generator/trunk/src/conf/build.properties (original)
+++ db/torque/generator/trunk/src/conf/build.properties Sun Jan 29 12:35:08 2006
@@ -121,6 +121,11 @@
#
# beanSuffix
# A String to append to the class name of generated beans (if they are
generated)
+#
+# enableJava5Features
+# If true, the generator will use Java5 generics in the generated code.
+
+
# -------------------------------------------------------------------
@@ -138,6 +143,7 @@
torque.silentDbFetch = true
torque.generateBeans = false
torque.beanSuffix = Bean
+torque.enableJava5Features = false
# -------------------------------------------------------------------
#
Modified: db/torque/maven-plugin/trunk/plugin.properties
URL:
http://svn.apache.org/viewcvs/db/torque/maven-plugin/trunk/plugin.properties?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/maven-plugin/trunk/plugin.properties (original)
+++ db/torque/maven-plugin/trunk/plugin.properties Sun Jan 29 12:35:08 2006
@@ -130,6 +130,7 @@
torque.correctGetters = false
torque.generateBeans = ${generateBeans}
torque.beanSuffix = ${beanSuffix}
+torque.enableJava5Features = false
torque.subpackage.base.bean = bean
torque.subpackage.bean = bean
Modified: db/torque/templates/trunk/src/templates/om/BaseManager.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/BaseManager.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/BaseManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/BaseManager.vm Sun Jan 29
12:35:08 2006
@@ -51,6 +51,11 @@
/**
* This class manages $interfaceName objects.
+#if ($table.description)
+ *
+ * $!table.description
+ *
+#end
* This class was autogenerated by Torque #if ($addTimeStamp)on:
*
* [$now]
@@ -177,7 +182,7 @@
* @return a <code>List</code> value
* @exception TorqueException if an error occurs
*/
- public static List getInstances(List ids)
+ public static List#if($enableJava5Features)<$interfaceName>#end
getInstances(List#if($enableJava5Features)<ObjectKey>#end ids)
throws TorqueException
{
return getManager().getInstancesImpl(ids);
@@ -192,7 +197,7 @@
* @return a <code>List</code> value
* @exception TorqueException if an error occurs
*/
- public static List getInstances(List ids, boolean fromCache)
+ public static List#if($enableJava5Features)<$interfaceName>#end
getInstances(List#if($enableJava5Features)<ObjectKey>#end ids, boolean
fromCache)
throws TorqueException
{
return getManager().getInstancesImpl(ids, fromCache);
@@ -298,7 +303,7 @@
* @return a <code>List</code> of ${interfaceName}s
* @exception TorqueException if an error occurs
*/
- protected List getInstancesImpl(List ids)
+ protected List#if($enableJava5Features)<$interfaceName>#end
getInstancesImpl(List#if($enableJava5Features)<ObjectKey>#end ids)
throws TorqueException
{
return getOMs(ids);
@@ -313,7 +318,7 @@
* @return a <code>List</code> of ${interfaceName}s
* @exception TorqueException if an error occurs
*/
- protected List getInstancesImpl(List ids, boolean fromCache)
+ protected List#if($enableJava5Features)<$interfaceName>#end
getInstancesImpl(List#if($enableJava5Features)<ObjectKey>#end ids, boolean
fromCache)
throws TorqueException
{
return getOMs(ids, fromCache);
@@ -349,7 +354,7 @@
* @return a <code>List</code> value
* @exception TorqueException if an error occurs
*/
- protected List retrieveStoredOMs(List ids)
+ protected List#if($enableJava5Features)<$table.JavaName>#end
retrieveStoredOMs(List ids)
throws TorqueException
{
return ${table.JavaName}Peer.${retrieveMethod}s(ids);
Modified: db/torque/templates/trunk/src/templates/om/ExtensionManager.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/ExtensionManager.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ExtensionManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ExtensionManager.vm Sun Jan 29
12:35:08 2006
@@ -26,6 +26,11 @@
/**
* This class manages $interfaceName objects.
+#if ($table.description)
+ *
+ * $!table.description
+ *
+#end
* The skeleton for this class was autogenerated by Torque #if
($addTimeStamp)on:
*
* [$now]
Modified: db/torque/templates/trunk/src/templates/om/ExtensionObject.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/ExtensionObject.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ExtensionObject.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ExtensionObject.vm Sun Jan 29
12:35:08 2006
@@ -24,6 +24,10 @@
import org.apache.torque.om.Persistent;
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* The skeleton for this class was autogenerated by Torque on:
*
Modified: db/torque/templates/trunk/src/templates/om/ExtensionPeer.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/ExtensionPeer.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ExtensionPeer.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ExtensionPeer.vm Sun Jan 29
12:35:08 2006
@@ -14,6 +14,10 @@
package ${packagePeer};
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* The skeleton for this class was autogenerated by Torque on:
*
Modified: db/torque/templates/trunk/src/templates/om/Interface.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/Interface.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Interface.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Interface.vm Sun Jan 29 12:35:08
2006
@@ -19,6 +19,10 @@
package $packageObject;
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
* This is an interface that should be filled with the public api of the
* $table.JavaName objects.
* The skeleton for this class was autogenerated by Torque #if
($addTimeStamp)on:
Modified: db/torque/templates/trunk/src/templates/om/MapBuilder.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/MapBuilder.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/MapBuilder.vm (original)
+++ db/torque/templates/trunk/src/templates/om/MapBuilder.vm Sun Jan 29
12:35:08 2006
@@ -23,6 +23,10 @@
import org.apache.torque.map.TableMap;
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* This class was autogenerated by Torque on:
*
Modified: db/torque/templates/trunk/src/templates/om/Object.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/Object.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Object.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Object.vm Sun Jan 29 12:35:08
2006
@@ -71,6 +71,10 @@
#end
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* This class was autogenerated by Torque on:
*
@@ -564,7 +568,7 @@
/**
* Collection to store aggregation of $collName
*/
- protected List $collName;
+ protected List#if($enableJava5Features)<$className>#end $collName;
/**
* Temporary storage of $collName to save a possible db hit in
@@ -575,7 +579,7 @@
{
if ($collName == null)
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
}
@@ -621,7 +625,7 @@
* @throws TorqueException
#end
*/
- public List get${relCol}()
+ public List#if($enableJava5Features)<$className>#end get${relCol}()
#if ($silentDbFetch)
throws TorqueException
#end
@@ -659,14 +663,14 @@
*
* @throws TorqueException
*/
- public List get${relCol}(Criteria criteria) throws TorqueException
+ public List#if($enableJava5Features)<$className>#end get${relCol}(Criteria
criteria) throws TorqueException
{
#if ($objectIsCaching)
if ($collName == null)
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -721,7 +725,7 @@
* referenced objects can also be obtained using a Connection
* that is taken as input
*/
- public List get${relCol}(Connection con) throws TorqueException
+ public List#if($enableJava5Features)<$className>#end
get${relCol}(Connection con) throws TorqueException
{
#if ($objectIsCaching)
if ($collName == null)
@@ -750,7 +754,7 @@
* referenced objects can also be obtained using a Connection
* that is taken as input
*/
- public List get${relCol}(Criteria criteria, Connection con)
+ public List#if($enableJava5Features)<$className>#end get${relCol}(Criteria
criteria, Connection con)
throws TorqueException
{
#if ($objectIsCaching)
@@ -758,7 +762,7 @@
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -878,7 +882,7 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected List get${relCol}Join${relCol2}(Criteria criteria)
+ protected List#if($enableJava5Features)<$className>#end
get${relCol}Join${relCol2}(Criteria criteria)
throws TorqueException
{
#if ($objectIsCaching)
@@ -886,7 +890,7 @@
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -948,7 +952,7 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected List get${relCol}JoinAllExcept${table.JavaName}(Criteria
criteria)
+ protected List#if($enableJava5Features)<$className>#end
get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria)
throws TorqueException
{
#if ($objectIsCaching)
@@ -956,7 +960,7 @@
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -1008,18 +1012,18 @@
## getByName code
##
#if (!$table.isAlias() && $addGetByNameMethod)
- private static List fieldNames = null;
+ private static List#if($enableJava5Features)<String>#end fieldNames = null;
/**
* Generate a list of field names.
*
* @return a list of field names
*/
- public static synchronized List getFieldNames()
+ public static synchronized List#if($enableJava5Features)<String>#end
getFieldNames()
{
if (fieldNames == null)
{
- fieldNames = new ArrayList();
+ fieldNames = new ArrayList#if($enableJava5Features)<String>#end();
#foreach ($col in $table.Columns)
fieldNames.add("${col.JavaName}");
#end
@@ -1620,7 +1624,6 @@
#end
#if ($complexObjectModel)
- #set ( $list = "List " )
#foreach ($fk in $table.Referrers)
#set ( $tblFK = $fk.Table )
#if ( !($tblFK.Name.equals($table.Name)) )
@@ -1642,14 +1645,14 @@
#set ( $pCollNameNoS = "${className}RelatedBy$relCol" )
#end
- ${list}v = get${pCollName}();
+ List#if($enableJava5Features)<$className>#end v${pCollName} =
get${pCollName}();
## v can be null if the generator property
## torque.silentDbFetch is set to false
- if (v != null)
+ if (v${pCollName} != null)
{
- for (int i = 0; i < v.size(); i++)
+ for (int i = 0; i < v${pCollName}.size(); i++)
{
- $className obj = ($className) v.get(i);
+ ${className} obj = #if(!$enableJava5Features)($className)#end
v${pCollName}.get(i);
copyObj.add$pCollNameNoS(obj.copy());
}
}
@@ -1658,7 +1661,6 @@
copyObj.coll${pCollName} = null;
}
#end
- #set ( $list = "" )
#end
#end
#end
Modified: db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm Sun Jan 29
12:35:08 2006
@@ -80,6 +80,10 @@
#end
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* This class was autogenerated by Torque on:
*
@@ -559,7 +563,7 @@
/**
* Collection to store aggregation of $collName
*/
- protected List $collName;
+ protected List#if($enableJava5Features)<$className>#end $collName;
/**
* Temporary storage of $collName to save a possible db hit in
@@ -570,7 +574,7 @@
{
if ($collName == null)
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
}
@@ -616,7 +620,7 @@
* @throws TorqueException
#end
*/
- public List get${relCol}()
+ public List#if($enableJava5Features)<$className>#end get${relCol}()
#if ($silentDbFetch)
throws TorqueException
#end
@@ -654,14 +658,14 @@
*
* @throws TorqueException
*/
- public List get${relCol}(Criteria criteria) throws TorqueException
+ public List#if($enableJava5Features)<$className>#end get${relCol}(Criteria
criteria) throws TorqueException
{
#if ($objectIsCaching)
if ($collName == null)
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -716,7 +720,7 @@
* referenced objects can also be obtained using a Connection
* that is taken as input
*/
- public List get${relCol}(Connection con) throws TorqueException
+ public List#if($enableJava5Features)<$className>#end
get${relCol}(Connection con) throws TorqueException
{
#if ($objectIsCaching)
if ($collName == null)
@@ -745,7 +749,7 @@
* referenced objects can also be obtained using a Connection
* that is taken as input
*/
- public List get${relCol}(Criteria criteria, Connection con)
+ public List#if($enableJava5Features)<$className>#end get${relCol}(Criteria
criteria, Connection con)
throws TorqueException
{
#if ($objectIsCaching)
@@ -753,7 +757,7 @@
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -873,7 +877,7 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected List get${relCol}Join${relCol2}(Criteria criteria)
+ protected List#if($enableJava5Features)<$className>#end
get${relCol}Join${relCol2}(Criteria criteria)
throws TorqueException
{
#if ($objectIsCaching)
@@ -881,7 +885,7 @@
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -943,7 +947,7 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected List get${relCol}JoinAllExcept${table.JavaName}(Criteria
criteria)
+ protected List#if($enableJava5Features)<$className>#end
get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria)
throws TorqueException
{
#if ($objectIsCaching)
@@ -951,7 +955,7 @@
{
if (isNew())
{
- $collName = new ArrayList();
+ $collName = new
ArrayList#if($enableJava5Features)<$className>#end();
}
else
{
@@ -1003,18 +1007,18 @@
## getByName code
##
#if (!$table.isAlias() && $addGetByNameMethod)
- private static List fieldNames = null;
+ private static List#if($enableJava5Features)<String>#end fieldNames = null;
/**
* Generate a list of field names.
*
* @return a list of field names
*/
- public static synchronized List getFieldNames()
+ public static synchronized List#if($enableJava5Features)<String>#end
getFieldNames()
{
if (fieldNames == null)
{
- fieldNames = new ArrayList();
+ fieldNames = new ArrayList#if($enableJava5Features)<String>#end();
#foreach ($col in $table.Columns)
fieldNames.add("${col.JavaName}");
#end
@@ -1638,7 +1642,6 @@
#end
#if ($complexObjectModel)
- #set ( $list = "List " )
#foreach ($fk in $table.Referrers)
#set ( $tblFK = $fk.Table )
#if ( !($tblFK.Name.equals($table.Name)) )
@@ -1660,14 +1663,14 @@
#set ( $pCollNameNoS = "${className}RelatedBy$relCol" )
#end
- ${list}v = get${pCollName}();
+ List#if($enableJava5Features)<$className>#end v${pCollName} =
get${pCollName}();
## v can be null if the generator property
## torque.silentDbFetch is set to false
- if (v != null)
+ if (v${pCollName} != null)
{
- for (int i = 0; i < v.size(); i++)
+ for (int i = 0; i < v${pCollName}.size(); i++)
{
- $className obj = ($className) v.get(i);
+ ${className} obj = #if(!$enableJava5Features)($className)#end
v${pCollName}.get(i);
copyObj.add$pCollNameNoS(obj.copy());
}
}
@@ -1676,7 +1679,6 @@
copyObj.coll${pCollName} = null;
}
#end
- #set ( $list = "" )
#end
#end
#end
Modified: db/torque/templates/trunk/src/templates/om/Peer.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/Peer.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Peer.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Peer.vm Sun Jan 29 12:35:08 2006
@@ -52,6 +52,10 @@
#end
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* This class was autogenerated by Torque on:
*
@@ -167,13 +171,13 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List resultSet2Objects(java.sql.ResultSet results)
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
resultSet2Objects(java.sql.ResultSet results)
throws TorqueException
{
try
{
QueryDataSet qds = null;
- List rows = null;
+ List#if($enableJava5Features)<Record>#end rows = null;
try
{
qds = new QueryDataSet(results);
@@ -395,7 +399,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List doSelect(Criteria criteria) throws TorqueException
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
doSelect(Criteria criteria) throws TorqueException
{
return populateObjects(doSelectVillageRecords(criteria));
}
@@ -409,7 +413,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List doSelect(Criteria criteria, Connection con)
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
doSelect(Criteria criteria, Connection con)
throws TorqueException
{
return populateObjects(doSelectVillageRecords(criteria, con));
@@ -425,7 +429,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List doSelectVillageRecords(Criteria criteria)
+ public static List#if($enableJava5Features)<Record>#end
doSelectVillageRecords(Criteria criteria)
throws TorqueException
{
return $basePrefix${table.JavaName}Peer
@@ -441,7 +445,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List doSelectVillageRecords(Criteria criteria, Connection
con)
+ public static List#if($enableJava5Features)<Record>#end
doSelectVillageRecords(Criteria criteria, Connection con)
throws TorqueException
{
if (criteria.getSelectColumns().size() == 0)
@@ -471,15 +475,15 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List populateObjects(List records)
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
populateObjects(List#if($enableJava5Features)<Record>#end records)
throws TorqueException
{
- List results = new ArrayList(records.size());
+ List#if($enableJava5Features)<${table.JavaName}>#end results = new
ArrayList#if($enableJava5Features)<${table.JavaName}>#end(records.size());
// populate the object(s)
for (int i = 0; i < records.size(); i++)
{
- Record row = (Record) records.get(i);
+ Record row = #if(!$enableJava5Features)(Record)#end records.get(i);
#if ($table.ChildrenColumn)
results.add(${table.JavaName}Peer.row2Object(row, 1,
${table.JavaName}Peer.getOMClass(row, 1)));
@@ -662,7 +666,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List doSelect($table.JavaName obj) throws TorqueException
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
doSelect($table.JavaName obj) throws TorqueException
{
return doSelect(buildSelectCriteria(obj));
}
@@ -927,7 +931,7 @@
throws TorqueException, NoRowsException, TooManyRowsException
{
Criteria criteria = buildCriteria(pk);
- List v = doSelect(criteria, con);
+ List#if($enableJava5Features)<${table.JavaName}>#end v =
doSelect(criteria, con);
if (v.size() == 0)
{
throw new NoRowsException("Failed to select a row.");
@@ -949,11 +953,11 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List ${retrieveMethod}s(List pks)
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
${retrieveMethod}s(List#if($enableJava5Features)<ObjectKey>#end pks)
throws TorqueException
{
Connection db = null;
- List retVal = null;
+ List#if($enableJava5Features)<${table.JavaName}>#end retVal = null;
try
{
db = Torque.getConnection(DATABASE_NAME);
@@ -974,13 +978,13 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- public static List ${retrieveMethod}s( List pks, Connection dbcon )
+ public static List#if($enableJava5Features)<${table.JavaName}>#end
${retrieveMethod}s( List#if($enableJava5Features)<ObjectKey>#end pks,
Connection dbcon )
throws TorqueException
{
- List objs = null;
+ List#if($enableJava5Features)<${table.JavaName}>#end objs = null;
if (pks == null || pks.size() == 0)
{
- objs = new LinkedList();
+ objs = new
LinkedList#if($enableJava5Features)<${table.JavaName}>#end();
}
else
{
@@ -988,10 +992,10 @@
#if ($table.PrimaryKey.size() == 1)
criteria.addIn( $table.PrimaryKey.get(0).Name.toUpperCase(), pks );
#else
- Iterator iter = pks.iterator();
+ Iterator#if($enableJava5Features)<ObjectKey>#end iter =
pks.iterator();
while (iter.hasNext())
{
- ObjectKey pk = (ObjectKey)iter.next();
+ ObjectKey pk = #if(!$enableJava5Features)(ObjectKey)#end
iter.next();
SimpleKey[] keys = (SimpleKey[])pk.getValue();
#set ( $i = 0 )
#foreach ($col in $table.PrimaryKey)
@@ -1082,10 +1086,10 @@
#set ( $clo=$col.Name.toLowerCase() )
criteria.add($cup, $clo);
#end
- List v = doSelect(criteria, con);
+ List#if($enableJava5Features)<${table.JavaName}>#end v =
doSelect(criteria, con);
if (v.size() == 1)
{
- return ($table.JavaName) v.get(0);
+ return #if(!$enableJava5Features)($table.JavaName)#end v.get(0);
}
else
{
@@ -1152,7 +1156,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List doSelectJoin${joinColumnId}(Criteria criteria)
+ protected static List#if($enableJava5Features)<${table.JavaName}>#end
doSelectJoin${joinColumnId}(Criteria criteria)
throws TorqueException
{
return doSelectJoin${joinColumnId}(criteria, null);
@@ -1169,7 +1173,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List doSelectJoin${joinColumnId}(Criteria criteria,
Connection conn)
+ protected static List#if($enableJava5Features)<${table.JavaName}>#end
doSelectJoin${joinColumnId}(Criteria criteria, Connection conn)
throws TorqueException
{
setDbName(criteria);
@@ -1188,7 +1192,7 @@
correctBooleans(criteria);
- List rows;
+ List#if($enableJava5Features)<Record>#end rows;
if (conn == null)
{
rows = BasePeer.doSelect(criteria);
@@ -1198,11 +1202,11 @@
rows = BasePeer.doSelect(criteria,conn);
}
- List results = new ArrayList();
+ List#if($enableJava5Features)<${table.JavaName}>#end results = new
ArrayList#if($enableJava5Features)<${table.JavaName}>#end();
for (int i = 0; i < rows.size(); i++)
{
- Record row = (Record) rows.get(i);
+ Record row = #if(!$enableJava5Features)(Record)#end rows.get(i);
#set ($classDecl = "Class")
#if ($table.ChildrenColumn)
@@ -1211,7 +1215,7 @@
$classDecl omClass = ${table.JavaName}Peer.getOMClass();
#end
#set ($classDecl = "")
- $className obj1 = ($className) ${table.JavaName}Peer
+ $className obj1 = ${table.JavaName}Peer
.row2Object(row, 1, omClass);
#if ($joinTable.ChildrenColumn)
$classDecl omClass = ${joinClassName}Peer.getOMClass(row, offset);
@@ -1219,14 +1223,14 @@
$classDecl omClass = ${joinClassName}Peer.getOMClass();
#end
#set ($classDecl = "")
- $joinClassName obj2 = ($joinClassName)${joinClassName}Peer
+ $joinClassName obj2 = ${joinClassName}Peer
.row2Object(row, offset, omClass);
boolean newObject = true;
for (int j = 0; j < results.size(); j++)
{
- $className temp_obj1 = ($className)results.get(j);
- $joinClassName temp_obj2 =
($joinClassName)temp_obj1.get${joinInterface}();
+ $className temp_obj1 =
#if(!$enableJava5Features)($className)#end results.get(j);
+ $joinClassName temp_obj2 = temp_obj1.get${joinInterface}();
if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
{
newObject = false;
@@ -1299,7 +1303,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List doSelectJoinAllExcept${excludeString}(Criteria
criteria)
+ protected static List#if($enableJava5Features)<${table.JavaName}>#end
doSelectJoinAllExcept${excludeString}(Criteria criteria)
throws TorqueException
{
return doSelectJoinAllExcept${excludeString}(criteria, null);
@@ -1316,7 +1320,7 @@
* @throws TorqueException Any exceptions caught during processing will be
* rethrown wrapped into a TorqueException.
*/
- protected static List doSelectJoinAllExcept${excludeString}(Criteria
criteria, Connection conn)
+ protected static List#if($enableJava5Features)<${table.JavaName}>#end
doSelectJoinAllExcept${excludeString}(Criteria criteria, Connection conn)
throws TorqueException
{
setDbName(criteria);
@@ -1349,7 +1353,7 @@
correctBooleans(criteria);
- List rows;
+ List#if($enableJava5Features)<Record>#end rows;
if (conn == null)
{
rows = BasePeer.doSelect(criteria);
@@ -1359,11 +1363,11 @@
rows = BasePeer.doSelect(criteria,conn);
}
- List results = new ArrayList();
+ List#if($enableJava5Features)<${table.JavaName}>#end results = new
ArrayList#if($enableJava5Features)<${table.JavaName}>#end();
for (int i = 0; i < rows.size(); i++)
{
- Record row = (Record)rows.get(i);
+ Record row = #if(!$enableJava5Features)(Record)#end rows.get(i);
#set ($classDecl = "Class")
#if ($table.ChildrenColumn)
@@ -1372,7 +1376,7 @@
$classDecl omClass = ${table.JavaName}Peer.getOMClass();
#end
#set ($classDecl = "")
- $className obj1 = ($className)${table.JavaName}Peer
+ $className obj1 = ${table.JavaName}Peer
.row2Object(row, 1, omClass);
#set ( $index = 1 )
#foreach ($fk in $table.ForeignKeys)
@@ -1412,14 +1416,14 @@
$classDecl omClass = ${joinClassName}Peer.getOMClass();
#end
#set ($classDecl = "")
- $joinClassName obj$index = ($joinClassName)${joinClassName}Peer
+ $joinClassName obj$index = ${joinClassName}Peer
.row2Object( row, offset$index, omClass);
#if ($index == 2) boolean #end newObject = true;
for (int j = 0; j < results.size(); j++)
{
- $className temp_obj1 = ($className)results.get(j);
- $joinClassName temp_obj$index =
($joinClassName)temp_obj1.get${joinString}();
+ $className temp_obj1 =
#if(!$enableJava5Features)($className)#end results.get(j);
+ $joinClassName temp_obj$index = temp_obj1.get${joinString}();
if
(temp_obj${index}.getPrimaryKey().equals(obj${index}.getPrimaryKey()))
{
newObject = false;
Modified: db/torque/templates/trunk/src/templates/om/bean/Bean.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/bean/Bean.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/bean/Bean.vm (original)
+++ db/torque/templates/trunk/src/templates/om/bean/Bean.vm Sun Jan 29 12:35:08
2006
@@ -44,6 +44,10 @@
#end
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* This class was autogenerated by Torque on:
*
@@ -313,12 +317,12 @@
/**
* Collection to store aggregation of $collName
*/
- protected List $collName;
+ protected List#if($enableJava5Features)<${className}${beanSuffix}>#end
$collName;
/**
* Returns the collection of ${relCol}
*/
- public List get${relCol}()
+ public List#if($enableJava5Features)<${className}${beanSuffix}>#end
get${relCol}()
{
return $collName;
}
@@ -326,7 +330,7 @@
/**
* Sets the collection of ${relCol} to the specified value
*/
- public void set${relCol}(List list)
+ public void
set${relCol}(List#if($enableJava5Features)<${className}${beanSuffix}>#end list)
{
if (list == null)
{
@@ -334,7 +338,7 @@
}
else
{
- $collName = new ArrayList(list);
+ $collName = new
ArrayList#if($enableJava5Features)<${className}${beanSuffix}>#end(list);
}
}
Modified: db/torque/templates/trunk/src/templates/om/bean/ExtensionBean.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/bean/ExtensionBean.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/bean/ExtensionBean.vm (original)
+++ db/torque/templates/trunk/src/templates/om/bean/ExtensionBean.vm Sun Jan 29
12:35:08 2006
@@ -20,6 +20,10 @@
import java.io.Serializable;
/**
+#if ($table.description)
+ * $!table.description
+ *
+#end
#if ($addTimeStamp)
* The skeleton for this class was autogenerated by Torque on:
*
Modified: db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm
URL:
http://svn.apache.org/viewcvs/db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm?rev=373352&r1=373351&r2=373352&view=diff
==============================================================================
--- db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm
(original)
+++ db/torque/templates/trunk/src/templates/om/bean/ObjectBeanMethods.vm Sun
Jan 29 12:35:08 2006
@@ -77,8 +77,8 @@
#set ( $collName = "coll$relCol" )
if ($collName != null)
{
- List relatedBeans = new ArrayList(${collName}.size());
- for (Iterator ${collName}It = ${collName}.iterator();
${collName}It.hasNext(); )
+ List#if($enableJava5Features)<$relatedBeanClassName>#end
relatedBeans = new
ArrayList#if($enableJava5Features)<$relatedBeanClassName>#end(${collName}.size());
+ for (Iterator#if($enableJava5Features)<$relatedClassName>#end
${collName}It = ${collName}.iterator(); ${collName}It.hasNext(); )
{
$relatedClassName related = ($relatedClassName)
${collName}It.next();
${relatedBeanClassName} relatedBean =
related.getBean(createdBeans);
@@ -193,12 +193,12 @@
#end
{
- List relatedBeans = bean.get${beanRelCol}();
+ List#if($enableJava5Features)<$relatedBeanClassName>#end
relatedBeans = bean.get${beanRelCol}();
if (relatedBeans != null)
{
- for (Iterator relatedBeansIt = relatedBeans.iterator();
relatedBeansIt.hasNext(); )
+ for
(Iterator#if($enableJava5Features)<$relatedBeanClassName>#end relatedBeansIt =
relatedBeans.iterator(); relatedBeansIt.hasNext(); )
{
- $relatedBeanClassName relatedBean =
($relatedBeanClassName) relatedBeansIt.next();
+ $relatedBeanClassName relatedBean =
#if(!$enableJava5Features)($relatedBeanClassName)#end relatedBeansIt.next();
${relatedClassName} related =
${relatedClassName}.create${relatedClassName}(relatedBean, createdObjects);
result.add${relatedClassName}FromBean(related);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]