db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject cvs commit: db-torque/xdocs changes.xml
Date Sat, 30 Oct 2004 12:10:32 GMT
henning     2004/10/30 05:10:32

  Modified:    src/generator/src/java/org/apache/torque/engine/database/model
                        Tag: TORQUE_3_1_BRANCH Column.java Table.java
               src/generator/src/templates/om Tag: TORQUE_3_1_BRANCH
                        Control.vm Object.vm ObjectWithManager.vm Peer.vm
               src/generator/xdocs Tag: TORQUE_3_1_BRANCH
                        properties-reference.xml
               src/maven-plugin Tag: TORQUE_3_1_BRANCH plugin.properties
               xdocs    Tag: TORQUE_3_1_BRANCH changes.xml
  Log:
  Add the "Java Bean compliant getter names for boolean columns" patch
  proposed before the 3.1.1 release and make it configurable. Default is
  still to generate the old (incorrect) names.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.5.2.6   +62 -2     db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java
  
  Index: Column.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java,v
  retrieving revision 1.5.2.5
  retrieving revision 1.5.2.6
  diff -u -r1.5.2.5 -r1.5.2.6
  --- Column.java	11 Sep 2004 13:57:33 -0000	1.5.2.5
  +++ Column.java	30 Oct 2004 12:10:31 -0000	1.5.2.6
  @@ -37,7 +37,8 @@
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
  + * @author <a href="mailto:byron_foster@yahoo.com>Byron Foster</a>
  + * @author <a href="mailto:hps@intermeta.de>Henning P. Schmiedehausen</a>
    * @version $Id$
    */
   public class Column
  @@ -71,6 +72,9 @@
       private List inheritanceList;
       private boolean needsTransactionInPostgres;
   
  +    /** generate is... setters for boolean columns if true */
  +    private boolean correctGetters = false;
  +
       /** class name to do input validation on this column */
       private String inputValidator = null;
   
  @@ -246,6 +250,37 @@
       }
       
       /**
  +     * Returns the name for the getter method to retrieve the value of this
  +     * column
  +     *
  +     * @return A getter method name for this column.
  +     * @since 3.1.2
  +     */
  +    public String getGetterName()
  +    {
  +        if (("boolean".equalsIgnoreCase(getJavaNative()) && isCorrectGetters()))
  +        {
  +            return "is" + StringUtils.capitalize(getJavaName());
  +        }
  +        else
  +        {
  +            return "get" + StringUtils.capitalize(getJavaName());
  +        }
  +    }
  +
  +    /**
  +     * Returns the name for the setter method to set the value of this
  +     * column
  +     *
  +     * @return A setter method name for this column.
  +     * @since 3.1.2
  +     */
  +    public String getSetterName()
  +    {
  +        return "set" + StringUtils.capitalize(getJavaName());
  +    }
  +
  +    /**
        * Get variable name to use in Java sources (= uncapitalised java name)
        */    
       public String getUncapitalisedJavaName()
  @@ -878,4 +913,29 @@
               || (s == null && !"object".equals(
                  getTable().getDatabase().getDefaultJavaType()));
       }
  +
  +    /**
  +     * Return the correctGetters property of the column
  +     *
  +     * @return The currentValue of the correctGetters property.
  +     * @since 3.1.2
  +     */
  +    public boolean isCorrectGetters()
  +    {
  +        return correctGetters;
  +    }
  +
  +    /**
  +     * Set the correctGetters property of the column. If set to true, the 
  +     * column returns is&lt;xxx&gt; as the getter name which is correct for the
  +     * Bean Specs but incompatible to pre-3.1.2 releases.
  +     *
  +     * @param correctGetters The new value of the correctGetters property.
  +     * @since 3.1.2
  +     */
  +    public void setCorrectGetters(boolean correctGetters)
  +    {
  +        this.correctGetters = correctGetters;
  +    }
  +
   }
  
  
  
  1.3.2.5   +18 -1     db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Table.java,v
  retrieving revision 1.3.2.4
  retrieving revision 1.3.2.5
  diff -u -r1.3.2.4 -r1.3.2.5
  --- Table.java	23 Aug 2004 00:29:52 -0000	1.3.2.4
  +++ Table.java	30 Oct 2004 12:10:31 -0000	1.3.2.5
  @@ -352,6 +352,7 @@
       {
           Column col = new Column();
           col.setTable(this);
  +        col.setCorrectGetters(false);
           col.loadFromXML(attrib);
           addColumn(col);
           return col;
  @@ -1161,5 +1162,21 @@
               }
           }
           return result.toString();
  +    }
  +
  +    /**
  +     * Force all columns to set the correctGetters property.
  +     *
  +     * @param correctGetters The new value of the correctGetters property.
  +     * @since 3.1.2
  +     */
  +    public void setCorrectGetters(Boolean value)
  +    {
  +        boolean correctGetters = value.booleanValue();
  +        for (Iterator it = columnList.iterator(); it.hasNext(); )
  +        {
  +            Column col = (Column) it.next();
  +            col.setCorrectGetters(correctGetters);
  +        }
       }
   }
  
  
  
  No                   revision
  No                   revision
  1.4.2.1   +4 -0      db-torque/src/generator/src/templates/om/Control.vm
  
  Index: Control.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Control.vm,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Control.vm	7 Aug 2003 13:13:00 -0000	1.4
  +++ Control.vm	30 Oct 2004 12:10:32 -0000	1.4.2.1
  @@ -5,6 +5,8 @@
   dbprops.idMethod = $dbprops.get("idMethod")
   #include ( "sql/base/$targetDatabase/db.props" )
   
  +correctGetters = $!correctGetters
  +
   #foreach ($dataModel in $dataModels)
     #foreach ($database in $dataModel.Databases)
   
  @@ -34,6 +36,8 @@
       #foreach ($tbl in $database.Tables)
         #if (!$tbl.isForReferenceOnly())
           $tbl.Name
  +
  +        $!tbl.setCorrectGetters($!correctGetters)
           #set ( $firstcap=$tbl.JavaName )
   
           #set ( $fname = "$basePrefix${firstcap}Peer.java" )
  
  
  
  1.7.2.10  +128 -128  db-torque/src/generator/src/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Object.vm,v
  retrieving revision 1.7.2.9
  retrieving revision 1.7.2.10
  diff -u -r1.7.2.9 -r1.7.2.10
  --- Object.vm	20 Oct 2004 22:50:22 -0000	1.7.2.9
  +++ Object.vm	30 Oct 2004 12:10:32 -0000	1.7.2.10
  @@ -121,7 +121,7 @@
        *
        * @return $cjtype
        */
  -    public $cjtype get${cfc}()
  +    public $cjtype ${col.GetterName} ()
       {
           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)
  @@ -191,9 +191,9 @@
           #end
   
           #if($colFK.Primitive)
  -        if ($varName != null && !(${varName}.get${colFK.JavaName}() == v))
  +        if ($varName != null && !(${varName}.${colFK.GetterName}() == v))
           #else
  -        if ($varName != null && !ObjectUtils.equals(${varName}.get${colFK.JavaName}(),
v))
  +        if ($varName != null && !ObjectUtils.equals(${varName}.${colFK.GetterName}(),
v))
           #end
           {
               $varName = null;
  @@ -218,7 +218,7 @@
               for (int i = 0; i < ${collName}.size(); i++)
               {
                   ((${tblFK.JavaName}) ${collName}.get(i))
  -                    .set${colFK.JavaName}(v);
  +                    .${colFK.SetterName}(v);
               }
           }
             #end
  @@ -280,14 +280,14 @@
           #end
           #set ($coldefval =  "0") 
           #set ($coldefval = $column.DefaultValue)
  -            set${column.JavaName}($casttype $coldefval);
  +            ${column.SetterName}($casttype $coldefval);
         #else
  -            set${column.JavaName}(($column.JavaNative) null);
  +            ${column.SetterName}(($column.JavaNative) null);
         #end
           }
           else
           {
  -            set${column.JavaName}(v.get${colFK.JavaName}());
  +            ${column.SetterName}(v.${colFK.GetterName}());
           }
       #end
           $varName = v;
  @@ -374,35 +374,35 @@
   
             #set ($fktype = $col.JavaNative)
             #if ($fktype == "short")
  -        set${col.JavaName}(((NumberKey) keys[$i]).shortValue());
  +        ${col.SetterName}(((NumberKey) keys[$i]).shortValue());
             #elseif($fktype == "int")
  -        set${col.JavaName}(((NumberKey) keys[$i]).intValue());
  +        ${col.SetterName}(((NumberKey) keys[$i]).intValue());
             #elseif($fktype == "long")
  -        set${col.JavaName}(((NumberKey) keys[$i]).longValue());
  +        ${col.SetterName}(((NumberKey) keys[$i]).longValue());
             #elseif($fktype == "BigDecimal")
  -        set${col.JavaName}(((NumberKey) keys[$i]).getBigDecimal());
  +        ${col.SetterName}(((NumberKey) keys[$i]).getBigDecimal());
             #elseif($fktype == "byte")
  -        set${col.JavaName}(((NumberKey) keys[$i]).byteValue());
  +        ${col.SetterName}(((NumberKey) keys[$i]).byteValue());
             #elseif($fktype == "float")
  -        set${col.JavaName}(((NumberKey) keys[$i]).floatValue());
  +        ${col.SetterName}(((NumberKey) keys[$i]).floatValue());
             #elseif($fktype == "double")
  -        set${col.JavaName}(((NumberKey) keys[$i]).doubleValue());
  +        ${col.SetterName}(((NumberKey) keys[$i]).doubleValue());
             #elseif($fktype == "Short")
  -        set${col.JavaName}(new Short(((NumberKey) keys[$i]).shortValue()));
  +        ${col.SetterName}(new Short(((NumberKey) keys[$i]).shortValue()));
             #elseif($fktype == "Integer")
  -        set${col.JavaName}(new Integer(((NumberKey) keys[$i]).intValue()));
  +        ${col.SetterName}(new Integer(((NumberKey) keys[$i]).intValue()));
             #elseif($fktype == "Long")
  -        set${col.JavaName}(new Long(((NumberKey) keys[$i]).longValue()));
  +        ${col.SetterName}(new Long(((NumberKey) keys[$i]).longValue()));
             #elseif($fktype == "Byte")
  -        set${col.JavaName}(new Byte(((NumberKey) keys[$i]).byteValue()));
  +        ${col.SetterName}(new Byte(((NumberKey) keys[$i]).byteValue()));
             #elseif($fktype == "Float")
  -        set${col.JavaName}(new Float(((NumberKey) keys[$i]).floatValue()));
  +        ${col.SetterName}(new Float(((NumberKey) keys[$i]).floatValue()));
             #elseif($fktype == "Double")
  -        set${col.JavaName}(new Double(((NumberKey) keys[$i]).doubleValue()));
  +        ${col.SetterName}(new Double(((NumberKey) keys[$i]).doubleValue()));
             #elseif($fktype == "String")
  -        set${col.JavaName}(keys[$i].toString());
  +        ${col.SetterName}(keys[$i].toString());
             #elseif($fktype == "Date")
  -        set${col.JavaName}(((DateKey)keys[$i]).getDate());
  +        ${col.SetterName}(((DateKey)keys[$i]).getDate());
             #end
             #set ( $i = $i + 1 )
           #end
  @@ -412,35 +412,35 @@
   
           #set ($fktype = $col.JavaNative)
           #if ($fktype == "short")
  -        set${col.JavaName}(((NumberKey) key).shortValue());
  +        ${col.SetterName}(((NumberKey) key).shortValue());
           #elseif($fktype == "int")
  -        set${col.JavaName}(((NumberKey) key).intValue());
  +        ${col.SetterName}(((NumberKey) key).intValue());
           #elseif($fktype == "long")
  -        set${col.JavaName}(((NumberKey) key).longValue());
  +        ${col.SetterName}(((NumberKey) key).longValue());
           #elseif($fktype == "BigDecimal")
  -        set${col.JavaName}(((NumberKey) key).getBigDecimal());
  +        ${col.SetterName}(((NumberKey) key).getBigDecimal());
           #elseif($fktype == "byte")
  -        set${col.JavaName}(((NumberKey) key).byteValue());
  +        ${col.SetterName}(((NumberKey) key).byteValue());
           #elseif($fktype == "float")
  -        set${col.JavaName}(((NumberKey) key).floatValue());
  +        ${col.SetterName}(((NumberKey) key).floatValue());
           #elseif($fktype == "double")
  -        set${col.JavaName}(((NumberKey) key).doubleValue());
  +        ${col.SetterName}(((NumberKey) key).doubleValue());
           #elseif($fktype == "Short")
  -        set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
  +        ${col.SetterName}(new Short(((NumberKey) key).shortValue()));
           #elseif($fktype == "Integer")
  -        set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
  +        ${col.SetterName}(new Integer(((NumberKey) key).intValue()));
           #elseif($fktype == "Long")
  -        set${col.JavaName}(new Long(((NumberKey) key).longValue()));
  +        ${col.SetterName}(new Long(((NumberKey) key).longValue()));
           #elseif($fktype == "Byte")
  -        set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
  +        ${col.SetterName}(new Byte(((NumberKey) key).byteValue()));
           #elseif($fktype == "Float")
  -        set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
  +        ${col.SetterName}(new Float(((NumberKey) key).floatValue()));
           #elseif($fktype == "Double")
  -        set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
  +        ${col.SetterName}(new Double(((NumberKey) key).doubleValue()));
           #elseif($fktype == "String")
  -        set${col.JavaName}(key.toString());
  +        ${col.SetterName}(key.toString());
           #elseif($fktype == "Date")
  -        set${col.JavaName}(((DateKey)key).getDate());
  +        ${col.SetterName}(((DateKey)key).getDate());
           #end
         #end
       }
  @@ -556,7 +556,7 @@
             #set ( $column = $table.getColumn($columnName) )
             #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
             #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}()
);
  +                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}()
);
           #end
                   $collName = ${className}Peer.doSelect(criteria);
               }
  @@ -574,7 +574,7 @@
           #set ( $column = $table.getColumn($columnName) )
           #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
           #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
         #end
         #if ($objectIsCaching)
                   if (!last${relCol}Criteria.equals(criteria))
  @@ -640,7 +640,7 @@
             #set ( $column = $table.getColumn($columnName) )
             #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
             #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                 criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +                 criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
           #end
                    $collName = ${className}Peer.doSelect(criteria, con);
                }
  @@ -658,7 +658,7 @@
           #set ( $column = $table.getColumn($columnName) )
           #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
           #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                 criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +                 criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
         #end
         #if ($objectIsCaching)
                    if (!last${relCol}Criteria.equals(criteria))
  @@ -764,7 +764,7 @@
                   #set ( $column = $table.getColumn($columnName) )
                   #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
                   #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
                 #end
                   $collName = ${className}Peer.doSelectJoin${relCol2}(criteria);
               }
  @@ -780,7 +780,7 @@
                 #set ( $column = $table.getColumn($columnName) )
                 #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
                 #set ( $colFK = $tblFK.getColumn($colFKName) )
  -            criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +            criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
               #end
               #if ($objectIsCaching)
               if (!last${relCol}Criteria.equals(criteria))
  @@ -831,7 +831,7 @@
            #set ( $column = $table.getColumn($columnName) )
            #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
            #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
        #end
                   $collName = ${className}Peer.doSelectJoinAllExcept${table.JavaName}${suffix}(criteria);
               }
  @@ -847,7 +847,7 @@
          #set ( $column = $table.getColumn($columnName) )
          #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
          #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, ${column.GetterName}());
      #end
      #if ($objectIsCaching)
               if (!last${relCol}Criteria.equals(criteria))
  @@ -909,23 +909,23 @@
           if (name.equals("${col.JavaName}"))
           {
       #if ($cjtype == "int")
  -            return new Integer(get${cfc}());
  +            return new Integer(${col.GetterName}());
       #elseif ($cjtype == "long")
  -            return new Long(get${cfc}());
  +            return new Long(${col.GetterName}());
       #elseif ($cjtype == "float")
  -            return new Float(get${cfc}());
  +            return new Float(${col.GetterName}());
       #elseif ($cjtype == "double")
  -            return new Double(get${cfc}());
  +            return new Double(${col.GetterName}());
       #elseif ($cjtype == "boolean")
  -            return Boolean.valueOf(get${cfc}());
  +            return Boolean.valueOf(${col.GetterName}());
       #elseif ($cjtype == "short")
  -            return new Short(get${cfc}());
  +            return new Short(${col.GetterName}());
       #elseif ($cjtype == "byte")
  -            return new Byte(get${cfc}());
  +            return new Byte(${col.GetterName}());
       #elseif ($cjtype == "char")
  -            return new Character(get${cfc}());
  +            return new Character(${col.GetterName}());
       #else
  -            return get${cfc}();
  +            return ${col.GetterName}();
       #end
           }
     #end
  @@ -949,23 +949,23 @@
           if (name.equals(${table.JavaName}Peer.$cup))
           {
       #if ($cjtype == "int")
  -            return new Integer(get${cfc}());
  +            return new Integer(${col.GetterName}());
       #elseif ($cjtype == "long")
  -            return new Long(get${cfc}());
  +            return new Long(${col.GetterName}());
       #elseif ($cjtype == "float")
  -            return new Float(get${cfc}());
  +            return new Float(${col.GetterName}());
       #elseif ($cjtype == "double")
  -            return new Double(get${cfc}());
  +            return new Double(${col.GetterName}());
       #elseif ($cjtype == "boolean")
  -            return Boolean.valueOf(get${cfc}());
  +            return Boolean.valueOf(${col.GetterName}());
       #elseif ($cjtype == "short")
  -            return new Short(get${cfc}());
  +            return new Short(${col.GetterName}());
       #elseif ($cjtype == "byte")
  -            return new Byte(get${cfc}());
  +            return new Byte(${col.GetterName}());
       #elseif ($cjtype == "char")
  -            return new Character(get${cfc}());
  +            return new Character(${col.GetterName}());
       #else
  -            return get${cfc}();
  +            return ${col.GetterName}();
       #end
           }
     #end
  @@ -988,23 +988,23 @@
           if (pos == $i)
           {
       #if ($cjtype == "int")
  -            return new Integer(get${cfc}());
  +            return new Integer(${col.GetterName}());
       #elseif ($cjtype == "long")
  -            return new Long(get${cfc}());
  +            return new Long(${col.GetterName}());
       #elseif ($cjtype == "float")
  -            return new Float(get${cfc}());
  +            return new Float(${col.GetterName}());
       #elseif ($cjtype == "double")
  -            return new Double(get${cfc}());
  +            return new Double(${col.GetterName}());
       #elseif ($cjtype == "boolean")
  -            return Boolean.valueOf(get${cfc}());
  +            return Boolean.valueOf(${col.GetterName}());
       #elseif ($cjtype == "short")
  -            return new Short(get${cfc}());
  +            return new Short(${col.GetterName}());
       #elseif ($cjtype == "byte")
  -            return new Byte(get${cfc}());
  +            return new Byte(${col.GetterName}());
       #elseif ($cjtype == "char")
  -            return new Character(get${cfc}());
  +            return new Character(${col.GetterName}());
       #else
  -            return get${cfc}();
  +            return ${col.GetterName}();
       #end
           }
       #set ($i = $i + 1)
  @@ -1133,7 +1133,7 @@
           if ($aVarName != null)
           {
               ${aVarName}.save(con);
  -            set$pVars.get($i)($aVarName);
  +            set${pVars}.get($i)($aVarName);
           }
         #end
       #end
  @@ -1225,37 +1225,37 @@
           $throwsClause
       {
       #if ($cjtype == "short")
  -        set${col.JavaName}(((NumberKey) key).shortValue());
  +        ${col.SetterName}(((NumberKey) key).shortValue());
       #elseif($cjtype == "int")
  -        set${col.JavaName}(((NumberKey) key).intValue());
  +        ${col.SetterName}(((NumberKey) key).intValue());
       #elseif($cjtype == "long")
  -        set${col.JavaName}(((NumberKey) key).longValue());
  +        ${col.SetterName}(((NumberKey) key).longValue());
       #elseif($cjtype == "BigDecimal")
  -        set${col.JavaName}(((NumberKey) key).getBigDecimal());
  +        ${col.SetterName}(((NumberKey) key).getBigDecimal());
       #elseif($cjtype == "byte")
  -        set${col.JavaName}(((NumberKey) key).byteValue());
  +        ${col.SetterName}(((NumberKey) key).byteValue());
       #elseif($cjtype == "float")
  -        set${col.JavaName}(((NumberKey) key).floatValue());
  +        ${col.SetterName}(((NumberKey) key).floatValue());
       #elseif($cjtype == "double")
  -        set${col.JavaName}(((NumberKey) key).doubleValue());
  +        ${col.SetterName}(((NumberKey) key).doubleValue());
       #elseif($cjtype == "Short")
  -        set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
  +        ${col.SetterName}(new Short(((NumberKey) key).shortValue()));
       #elseif($cjtype == "Integer")
  -        set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
  +        ${col.SetterName}(new Integer(((NumberKey) key).intValue()));
       #elseif($cjtype == "Long")
  -        set${col.JavaName}(new Long(((NumberKey) key).longValue()));
  +        ${col.SetterName}(new Long(((NumberKey) key).longValue()));
       #elseif($cjtype == "Byte")
  -        set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
  +        ${col.SetterName}(new Byte(((NumberKey) key).byteValue()));
       #elseif($cjtype == "Float")
  -        set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
  +        ${col.SetterName}(new Float(((NumberKey) key).floatValue()));
       #elseif($cjtype == "Double")
  -        set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
  +        ${col.SetterName}(new Double(((NumberKey) key).doubleValue()));
       #elseif($cjtype == "String")
  -        set${col.JavaName}(key.toString());
  +        ${col.SetterName}(key.toString());
       #elseif($cjtype == "Date")
  -        set${col.JavaName}(((DateKey) key).getDate());
  +        ${col.SetterName}(((DateKey) key).getDate());
       #else
  -        set${col.JavaName}(($cjtype) key);
  +        ${col.SetterName}(($cjtype) key);
       #end
       }
   
  @@ -1267,37 +1267,37 @@
       public void setPrimaryKey(String key) $throwsClause
       {
       #if ($cjtype == "short")
  -        set${col.JavaName}(Short.parseShort(key));
  +        ${col.SetterName}(Short.parseShort(key));
       #elseif($cjtype == "int")
  -        set${col.JavaName}(Integer.parseInt(key));
  +        ${col.SetterName}(Integer.parseInt(key));
       #elseif($cjtype == "long")
  -        set${col.JavaName}(Long.parseLong(key));
  +        ${col.SetterName}(Long.parseLong(key));
       #elseif($cjtype == "BigDecimal")
  -        set${col.JavaName}(new BigDecimal(key));
  +        ${col.SetterName}(new BigDecimal(key));
       #elseif($cjtype == "byte")
  -        set${col.JavaName}(Byte.parseByte(key));
  +        ${col.SetterName}(Byte.parseByte(key));
       #elseif($cjtype == "float")
  -        set${col.JavaName}(Float.parseFloat(key));
  +        ${col.SetterName}(Float.parseFloat(key));
       #elseif($cjtype == "double")
  -        set${col.JavaName}(Double.parseDouble(key));
  +        ${col.SetterName}(Double.parseDouble(key));
       #elseif($cjtype == "Short")
  -        set${col.JavaName}(new Short(key));
  +        ${col.SetterName}(new Short(key));
       #elseif($cjtype == "Integer")
  -        set${col.JavaName}(new Integer(key));
  +        ${col.SetterName}(new Integer(key));
       #elseif($cjtype == "Long")
  -        set${col.JavaName}(new Long(key));
  +        ${col.SetterName}(new Long(key));
       #elseif($cjtype == "Byte")
  -        set${col.JavaName}(new Byte(key));
  +        ${col.SetterName}(new Byte(key));
       #elseif($cjtype == "Float")
  -        set${col.JavaName}(new Float(key));
  +        ${col.SetterName}(new Float(key));
       #elseif($cjtype == "Double")
  -        set${col.JavaName}(new Double(key));
  +        ${col.SetterName}(new Double(key));
       #elseif($cjtype == "String")
  -        set${col.JavaName}(key);
  +        ${col.SetterName}(key);
       #elseif($cjtype == "Date")
  -        set${col.JavaName}(new Date(key));
  +        ${col.SetterName}(new Date(key));
       #else
  -        set${col.JavaName}(new ${cjtype}(key));
  +        ${col.SetterName}(new ${cjtype}(key));
       #end
       }
   
  @@ -1319,35 +1319,35 @@
       #foreach ($pk in $table.PrimaryKey)
         #set ($pktype = $pk.JavaNative)
         #if ($pktype == "short")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).shortValue());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).shortValue());
         #elseif($pktype == "int")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).intValue());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).intValue());
         #elseif($pktype == "long")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).longValue());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).longValue());
         #elseif($pktype == "BigDecimal")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).getBigDecimal());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).getBigDecimal());
         #elseif($pktype == "byte")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).byteValue());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).byteValue());
         #elseif($pktype == "float")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).floatValue());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).floatValue());
         #elseif($pktype == "double")
  -        set${pk.JavaName}(((NumberKey)keys[$i]).doubleValue());
  +        ${pk.SetterName}(((NumberKey)keys[$i]).doubleValue());
         #elseif($pktype == "Short")
  -        set${pk.JavaName}(new Short(((NumberKey)keys[$i]).shortValue()));
  +        ${pk.SetterName}(new Short(((NumberKey)keys[$i]).shortValue()));
         #elseif($pktype == "Integer")
  -        set${pk.JavaName}(new Integer(((NumberKey)keys[$i]).intValue()));
  +        ${pk.SetterName}(new Integer(((NumberKey)keys[$i]).intValue()));
         #elseif($pktype == "Long")
  -        set${pk.JavaName}(new Long(((NumberKey)keys[$i]).longValue()));
  +        ${pk.SetterName}(new Long(((NumberKey)keys[$i]).longValue()));
         #elseif($pktype == "Byte")
  -        set${pk.JavaName}(new Byte(((NumberKey)keys[$i]).byteValue()));
  +        ${pk.SetterName}(new Byte(((NumberKey)keys[$i]).byteValue()));
         #elseif($pktype == "Float")
  -        set${pk.JavaName}(new Float(((NumberKey)keys[$i]).floatValue()));
  +        ${pk.SetterName}(new Float(((NumberKey)keys[$i]).floatValue()));
         #elseif($pktype == "Double")
  -        set${pk.JavaName}(new Double(((NumberKey)keys[$i]).doubleValue()));
  +        ${pk.SetterName}(new Double(((NumberKey)keys[$i]).doubleValue()));
         #elseif($pktype == "String")
  -        set${pk.JavaName}(keys[$i].toString());
  +        ${pk.SetterName}(keys[$i].toString());
         #elseif($pktype == "Date")
  -        set${pk.JavaName}(((DateKey)keys[$i]).getDate());
  +        ${pk.SetterName}(((DateKey)keys[$i]).getDate());
         #end
         #set ( $i = $i + 1 )
       #end
  @@ -1366,7 +1366,7 @@
           $throwsClause
       {
       #foreach ($col in $table.PrimaryKey)
  -        set${col.JavaName}($col.UncapitalisedJavaName);
  +        ${col.SetterName}($col.UncapitalisedJavaName);
       #end
       }
   
  @@ -1386,11 +1386,11 @@
       public ObjectKey getPrimaryKey()
       {
     #if ($table.PrimaryKey.size() == 1)
  -        return SimpleKey.keyFor(get${table.PrimaryKey.get(0).JavaName}());
  +        return SimpleKey.keyFor(${table.PrimaryKey.get(0).GetterName}());
     #elseif ($table.PrimaryKey.size() > 1)
       #set ($i = 0)
       #foreach ($pk in $table.PrimaryKey)
  -        pks[$i] = SimpleKey.keyFor(get${pk.JavaName}());
  +        pks[$i] = SimpleKey.keyFor(${pk.GetterName}());
         #set ($i = $i +1)
       #end
           return comboPK;
  @@ -1449,7 +1449,7 @@
       protected $table.JavaName copyInto($table.JavaName copyObj) throws TorqueException
       {
     #foreach ($col in $table.Columns)
  -        copyObj.set${col.JavaName}($col.UncapitalisedJavaName);
  +        copyObj.${col.SetterName}($col.UncapitalisedJavaName);
     #end
   
     #foreach ($col in $table.Columns)
  @@ -1464,11 +1464,11 @@
           #end
           #set ($coldefval = "0") 
           #set ($coldefval = $col.DefaultValue)
  -        copyObj.set${col.JavaName}($casttype $coldefval);
  +        copyObj.${col.SetterName}($casttype $coldefval);
         #else
           #set ( $pkid = "null" )
           #set ( $cjtype = $col.JavaNative )
  -        copyObj.set${col.JavaName}((${cjtype})${pkid});
  +        copyObj.${col.SetterName}((${cjtype})${pkid});
         #end
       #end
     #end
  @@ -1534,7 +1534,7 @@
     #if ( $cjtype == "byte[]" )
              .append("<binary>")
     #else
  -           .append(get${col.JavaName}())
  +           .append(${col.GetterName}())
     #end
              .append("\n");
   #end
  
  
  
  1.5.2.8   +30 -33    db-torque/src/generator/src/templates/om/ObjectWithManager.vm
  
  Index: ObjectWithManager.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/ObjectWithManager.vm,v
  retrieving revision 1.5.2.7
  retrieving revision 1.5.2.8
  diff -u -r1.5.2.7 -r1.5.2.8
  --- ObjectWithManager.vm	20 Oct 2004 22:50:22 -0000	1.5.2.7
  +++ ObjectWithManager.vm	30 Oct 2004 12:10:32 -0000	1.5.2.8
  @@ -122,7 +122,7 @@
        *
        * @return $cjtype
        */
  -    public $cjtype get${cfc}()
  +    public $cjtype ${col.GetterName}()
       {
           return $clo;
       }
  @@ -144,7 +144,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)
  @@ -860,28 +860,27 @@
       public Object getByName(String name)
       {
     #foreach ($col in $table.Columns)
  -    #set ( $cfc = $col.JavaName )
       #set ( $cjtype = $col.JavaNative )
           if (name.equals("${col.JavaName}"))
           {
       #if ($cjtype == "int")
  -            return new Integer(get${cfc}());
  +            return new Integer(${col.GetterName}());
       #elseif ($cjtype == "long")
  -            return new Long(get${cfc}());
  +            return new Long(${col.GetterName}());
       #elseif ($cjtype == "float")
  -            return new Float(get${cfc}());
  +            return new Float(${col.GetterName}());
       #elseif ($cjtype == "double")
  -            return new Double(get${cfc}());
  +            return new Double(${col.GetterName}());
       #elseif ($cjtype == "boolean")
  -            return Boolean.valueOf(get${cfc}());
  +            return Boolean.valueOf(${col.GetterName}());
       #elseif ($cjtype == "short")
  -            return new Short(get${cfc}());
  +            return new Short(${col.GetterName}());
       #elseif ($cjtype == "byte")
  -            return new Byte(get${cfc}());
  +            return new Byte(${col.GetterName}());
       #elseif ($cjtype == "char")
  -            return new Character(get${cfc}());
  +            return new Character(${col.GetterName}());
       #else
  -            return get${cfc}();
  +            return ${col.GetterName}();
       #end
           }
     #end
  @@ -899,29 +898,28 @@
       public Object getByPeerName(String name)
       {
     #foreach ($col in $table.Columns)
  -    #set ( $cfc = $col.JavaName )
       #set ( $cup=$col.Name.toUpperCase() )
       #set ( $cjtype = $col.JavaNative )
           if (name.equals(${table.JavaName}Peer.$cup))
           {
       #if ($cjtype == "int")
  -            return new Integer(get${cfc}());
  +            return new Integer(${col.GetterName}());
       #elseif ($cjtype == "long")
  -            return new Long(get${cfc}());
  +            return new Long(${col.GetterName}());
       #elseif ($cjtype == "float")
  -            return new Float(get${cfc}());
  +            return new Float(${col.GetterName}());
       #elseif ($cjtype == "double")
  -            return new Double(get${cfc}());
  +            return new Double(${col.GetterName}());
       #elseif ($cjtype == "boolean")
  -            return Boolean.valueOf(get${cfc}());
  +            return Boolean.valueOf(${col.GetterName}());
       #elseif ($cjtype == "short")
  -            return new Short(get${cfc}());
  +            return new Short(${col.GetterName}());
       #elseif ($cjtype == "byte")
  -            return new Byte(get${cfc}());
  +            return new Byte(${col.GetterName}());
       #elseif ($cjtype == "char")
  -            return new Character(get${cfc}());
  +            return new Character(${col.GetterName}());
       #else
  -            return get${cfc}();
  +            return ${col.GetterName}();
       #end
           }
     #end
  @@ -939,28 +937,27 @@
       {
     #set ($i = 0)
     #foreach ($col in $table.Columns)
  -    #set ( $cfc = $col.JavaName )
       #set ( $cjtype = $col.JavaNative )
           if (pos == $i)
           {
       #if ($cjtype == "int")
  -            return new Integer(get${cfc}());
  +            return new Integer(${col.GetterName}());
       #elseif ($cjtype == "long")
  -            return new Long(get${cfc}());
  +            return new Long(${col.GetterName}());
       #elseif ($cjtype == "float")
  -            return new Float(get${cfc}());
  +            return new Float(${col.GetterName}());
       #elseif ($cjtype == "double")
  -            return new Double(get${cfc}());
  +            return new Double(${col.GetterName}());
       #elseif ($cjtype == "boolean")
  -            return Boolean.valueOf(get${cfc}());
  +            return Boolean.valueOf(${col.GetterName}());
       #elseif ($cjtype == "short")
  -            return new Short(get${cfc}());
  +            return new Short(${col.GetterName}());
       #elseif ($cjtype == "byte")
  -            return new Byte(get${cfc}());
  +            return new Byte(${col.GetterName}());
       #elseif ($cjtype == "char")
  -            return new Character(get${cfc}());
  +            return new Character(${col.GetterName}());
       #else
  -            return get${cfc}();
  +            return ${col.GetterName}();
       #end
           }
       #set ($i = $i + 1)
  @@ -1503,7 +1500,7 @@
     #if ( $cjtype == "byte[]" )
              .append("<binary>")
     #else
  -           .append(get${col.JavaName}())
  +           .append(${col.GetterName}())
     #end
              .append("\n");
   #end
  
  
  
  1.5.2.13  +3 -4      db-torque/src/generator/src/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Peer.vm,v
  retrieving revision 1.5.2.12
  retrieving revision 1.5.2.13
  diff -u -r1.5.2.12 -r1.5.2.13
  --- Peer.vm	26 Oct 2004 12:48:30 -0000	1.5.2.12
  +++ Peer.vm	30 Oct 2004 12:10:32 -0000	1.5.2.13
  @@ -362,7 +362,7 @@
           {
     #set ( $n=0 )
     #foreach ($col in $table.Columns)
  -            obj.set${col.JavaName}(row.getValue(offset + $n).$col.VillageMethod);
  +            obj.${col.SetterName}(row.getValue(offset + $n).$col.VillageMethod);
       #set ( $n = $n + 1 )
     #end
           }
  @@ -894,11 +894,10 @@
     #foreach ($col in $table.Columns)
       #set ( $cfc=$col.JavaName )
       #set ( $cup=$col.Name.toUpperCase() )
  -    #set ( $cjtype = $col.JavaNative )
       #if ($col.isPrimaryKey() && !$table.IdMethod.equals("none"))
           if (!obj.isNew())
       #end
  -        criteria.add($cup, obj.get${cfc}());
  +        criteria.add($cup, obj.${col.GetterName}());
     #end
           return criteria;
       }
  @@ -915,7 +914,7 @@
           if (!obj.isNew())
       #end
       #if ( $cjtype != "byte[]" )
  -            criteria.add($cup, obj.get${cfc}());
  +            criteria.add($cup, obj.${col.GetterName}());
       #end
     #end
           return criteria;
  
  
  
  No                   revision
  No                   revision
  1.4.2.5   +9 -0      db-torque/src/generator/xdocs/properties-reference.xml
  
  Index: properties-reference.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/xdocs/properties-reference.xml,v
  retrieving revision 1.4.2.4
  retrieving revision 1.4.2.5
  diff -u -r1.4.2.4 -r1.4.2.5
  --- properties-reference.xml	16 Oct 2004 09:59:02 -0000	1.4.2.4
  +++ properties-reference.xml	30 Oct 2004 12:10:32 -0000	1.4.2.5
  @@ -5,6 +5,7 @@
     <properties>
       <title>Torque - Properties Reference</title>
       <author email="stephenh@chase3000.com">Stephen Haberman</author>
  +    <author email="hps@intermeta.de">Henning P. Schmiedehausen</author>
     </properties>
   
     <body>
  @@ -318,6 +319,14 @@
       key relationships. If this is not desired (because the underlying objects
       can be manipulated from other code), set this property to false. This currently
       cannot combined with the manager setting from above.
  +  </td>
  +</tr>
  +<tr>
  +  <td><code> torque.correctGetters </code></td>
  +  <td><code> false </code></td>
  +  <td>
  +    If true, Torque generates is&lt;xxx&gt; getter methods for boolean columns.
These are
  +    Bean-Spec compliant but break compatibility with all releases up to 3.1.1.
     </td>
   </tr>
   </tr>
  
  
  
  No                   revision
  No                   revision
  1.3.2.7   +2 -1      db-torque/src/maven-plugin/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/db-torque/src/maven-plugin/plugin.properties,v
  retrieving revision 1.3.2.6
  retrieving revision 1.3.2.7
  diff -u -r1.3.2.6 -r1.3.2.7
  --- plugin.properties	4 Sep 2004 13:29:19 -0000	1.3.2.6
  +++ plugin.properties	30 Oct 2004 12:10:32 -0000	1.3.2.7
  @@ -122,6 +122,7 @@
   torque.useClasspath = ${useClasspath}
   torque.useManagers = ${useManagers}
   torque.objectIsCaching = true
  +torque.correctGetters = false
   
   torque.omzip.src.base = false
   torque.omzip.src.extension = false
  
  
  
  No                   revision
  No                   revision
  1.140.2.18 +9 -0      db-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
  retrieving revision 1.140.2.17
  retrieving revision 1.140.2.18
  diff -u -r1.140.2.17 -r1.140.2.18
  --- changes.xml	26 Oct 2004 11:55:19 -0000	1.140.2.17
  +++ changes.xml	30 Oct 2004 12:10:32 -0000	1.140.2.18
  @@ -25,6 +25,15 @@
     </properties>
   
     <body>
  +  <release version="3.1.2-dev" date="in CVS">
  +    <action type="add" dev="henning">
  +      Make the getter names for the table column values configurable. Torque did generate
  +      non-Bean-Spec compliant getter names for boolean columns (get&lt;xxx&gt;
instead of is&lt;xxx&gt;).
  +      By setting <code>torque.correctGetters</code> to true, this can be changed.
This is a
  +      generator-only change, the resulting peers still run with the 3.1.1 runtime.
  +    </action>
  +  </release>
  +
     <release version="3.1.1" date="2004-10-26">
       <action type="update" dev="henning">
         Change PostgreSQL ID generation to use <code>select nextval</code>
  
  
  

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