db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r996384 - in /db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates: ./ platform/ skipdecider/ transformer/ transformer/om/
Date Sun, 12 Sep 2010 20:30:01 GMT
Author: tfischer
Date: Sun Sep 12 20:30:01 2010
New Revision: 996384

URL: http://svn.apache.org/viewvc?rev=996384&view=rev
Log:
Checkstyle stuff:
- javadoc
- private constructor for utility classes
- make utility classes final
- better names for class variables

Modified:
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformFactory.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/ManagerSkipDecider.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ColumnAttributeName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ForeignKeyChildAttributeName.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
    db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/TemplateOptionName.java
Sun Sep 12 20:30:01 2010
@@ -65,11 +65,13 @@ public enum TemplateOptionName implement
     /** The prefix of the name of the mapInit class. */
     OM_MAP_INIT_CLASS_NAME_PREFIX("torque.om.mapInit.mapInitClassNamePrefix"),
 
-    /** The prefix of the name of the mapInit class. */
+    /** The suffix of the name of the mapInit class. */
     OM_MAP_INIT_CLASS_NAME_SUFFIX("torque.om.mapInit.mapInitClassNameSuffix"),
 
+    /** The prefix of the name of the manager class. */
     OM_MANAGER_CLASS_NAME_PREFIX("torque.om.className.managerClassNamePrefix"),
 
+    /** The suffix of the name of the manager class. */
     OM_MANAGER_CLASS_NAME_SUFFIX("torque.om.className.managerClassNameSuffix");
 
     /**

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformFactory.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformFactory.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/platform/PlatformFactory.java
Sun Sep 12 20:30:01 2010
@@ -32,13 +32,23 @@ import org.apache.commons.logging.LogFac
  * @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
  * @version $Id: PlatformFactory.java 473814 2006-11-11 22:30:30 +0000 (Sat, 11 Nov 2006)
tv $
  */
-public class PlatformFactory
+public final class PlatformFactory
 {
+    /** All known platforms. */
     private static HashMap<String, Platform> platforms
             = new HashMap<String, Platform>();
+
+    /** The class log. */
     private static Log log = LogFactory.getLog(PlatformFactory.class);
 
     /**
+     * private constructor for utility class.
+     */
+    private PlatformFactory()
+    {
+    }
+
+    /**
      * Returns the Platform for a platform name.
      *
      * @param dbms name of the platform
@@ -87,7 +97,7 @@ public class PlatformFactory
         }
         String myClassname = PlatformFactory.class.getName();
         String myPackage
-                = myClassname.substring(0,myClassname.lastIndexOf("."));
+                = myClassname.substring(0, myClassname.lastIndexOf("."));
         return myPackage
                 + ".Platform"
                 + pf.substring(0, 1).toUpperCase()

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/ManagerSkipDecider.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/ManagerSkipDecider.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/ManagerSkipDecider.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/ManagerSkipDecider.java
Sun Sep 12 20:30:01 2010
@@ -28,6 +28,12 @@ import org.apache.torque.templates.Templ
 import org.apache.torque.templates.TorqueSchemaElementName;
 import org.apache.torque.templates.transformer.om.TableChildElementName;
 
+/**
+ * A skipSourceDecider which returns true if the option
+ * "torque.om.useManagers" is true and the current table has a primary key.
+ *
+ * @version $Id: $
+ */
 public class ManagerSkipDecider implements SkipDecider
 {
     public boolean proceed(ControllerState controllerState)

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
Sun Sep 12 20:30:01 2010
@@ -34,9 +34,16 @@ import org.apache.torque.templates.typem
  *
  * $Id: $
  */
-public class SchemaTypeHelper
+public final class SchemaTypeHelper
 {
     /**
+     * Private constructor for utility class.
+     */
+    private SchemaTypeHelper()
+    {
+    }
+
+    /**
      * Determines the schema type of a column.
      *
      * @param columnElement the source element which defines the column

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ColumnAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ColumnAttributeName.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ColumnAttributeName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ColumnAttributeName.java
Sun Sep 12 20:30:01 2010
@@ -36,10 +36,31 @@ public enum ColumnAttributeName implemen
      * Whether the column is a number column.
      */
     NUMBER_TYPE("number"),
+
+    /**
+     * The name of constant for the column name in the peer class.
+     */
     PEER_COLUMN_NAME("peerColumnName"),
+
+    /**
+     * The fully qualified name of the column,
+     * i. e. prefixed with the database schema name if a schema name was given.
+     */
     QUALIFIED_COLUMN_NAME("qualifiedColumnName"),
+
+    /**
+     * The column index, 1 based. First column 1, second column 2 etc.
+     */
     POSITION("position"),
+
+    /**
+     * The village method to retrieve a value for this column.
+     */
     VILLAGE_METHOD("villageMethod"),
+
+    /**
+     * An instance of the object for the type map.
+     */
     SAMPLE_OBJECT("sampleObject");
 
     /** The name of the source element attribute, not null. */

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ForeignKeyChildAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ForeignKeyChildAttributeName.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ForeignKeyChildAttributeName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/ForeignKeyChildAttributeName.java
Sun Sep 12 20:30:01 2010
@@ -58,7 +58,14 @@ public enum ForeignKeyChildAttributeName
      */
     FOREIGN_COLUMN_CRITERIA_CACHE_FIELD("criteriaCacheField"),
 
+    /**
+     * The name of the getter in the bean class.
+     */
     BEAN_GETTER("beanGetter"),
+
+    /**
+     * The name of the setter in the bean class.
+     */
     BEAN_SETTER("beanSetter");
 
     /** The name of the source element, not null. */

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/LoadExternalSchemaTransformer.java
Sun Sep 12 20:30:01 2010
@@ -44,6 +44,7 @@ import org.apache.torque.templates.Torqu
 // TODO: move to parent package org.apache.torque.templates.transformer
 public class LoadExternalSchemaTransformer implements SourceTransformer
 {
+    /** The class log. */
     private static Log log
             = LogFactory.getLog(LoadExternalSchemaTransformer.class);
 

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMColumnTransformer.java
Sun Sep 12 20:30:01 2010
@@ -42,12 +42,15 @@ import org.apache.torque.templates.typem
  */
 public class OMColumnTransformer
 {
-    private static Camelbacker camelbacker = new Camelbacker();
+    /** The camelbacker to create the java name from the column name. */
+    private static Camelbacker javaNameCamelbacker = new Camelbacker();
 
+    /** The transformer for inheritance elements. */
     private static OMInheritanceTransformer inheritanceTransformer
             = new OMInheritanceTransformer();
 
-    private static Set<String> RESERVED_CONSTANT_NAMES;
+    /** Names which cannot be used as constants for column names. */
+    private static final Set<String> RESERVED_CONSTANT_NAMES;
 
     static
     {
@@ -287,7 +290,7 @@ public class OMColumnTransformer
         }
         String columnName = (String) columnElement.getAttribute(
                 TorqueSchemaAttributeName.NAME);
-        String javaName = camelbacker.process(columnName);
+        String javaName = javaNameCamelbacker.process(columnName);
         columnElement.setAttribute(
                 TorqueSchemaAttributeName.JAVA_NAME,
                 javaName);

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
Sun Sep 12 20:30:01 2010
@@ -62,22 +62,70 @@ import org.apache.torque.templates.Torqu
  */
 public class OMForeignKeyTransformer
 {
+    /**
+     * The name of the option containing the prefix for the local field name
+     * of a foreign-key reference.
+     */
     private static final String LOCAL_FIELD_NAME_PREFIX_OPTION
             = "torque.om.complexObjectModel.localFieldNamePrefix";
+
+    /**
+     * The name of the option containing the suffix for the local field name
+     * of a foreign-key reference.
+     */
     private static final String LOCAL_FIELD_NAME_SUFFIX_OPTION
             = "torque.om.complexObjectModel.localFieldNameSuffix";
+
+    /**
+     * The name of the option for the filler between referenced table name
+     * and referencing column name
+     * (only used if the same foreign table is referenced several times)
+     * as used in the local field name.
+     */
     private static final String LOCAL_FIELD_NAME_RELATED_BY_OPTION
             = "torque.om.complexObjectModel.localFieldNameRelatedBy";
+
+    /**
+     * The name of the option containing the prefix for the foreign field name
+     * of a foreign-key reference.
+     */
     private static final String FOREIGN_FIELD_NAME_PREFIX_OPTION
         = "torque.om.complexObjectModel.foreignFieldNamePrefix";
+
+    /**
+     * The name of the option containing the suffix for the foreign field name
+     * of a foreign-key reference.
+     */
     private static final String FOREIGN_FIELD_NAME_SUFFIX_OPTION
         = "torque.om.complexObjectModel.foreignFieldNameSuffix";
+
+    /**
+     * The name of the option for the filler between referenced table name
+     * and referencing column name
+     * (only used if the same local table is referenced several times)
+     * as used in the foreign field name.
+     */
     private static final String FOREIGN_FIELD_NAME_RELATED_BY_OPTION
         = "torque.om.complexObjectModel.foreignFieldNameRelatedBy";
+
+    /**
+     * The name of the option for the java type for the foreign field
+     * (can be an interface),
+     */
     private static final String FOREIGN_FIELD_TYPE_OPTION
         = "torque.om.complexObjectModel.foreignFieldType";
+
+    /**
+     * The name of the option for the java type for the initial value
+     * of the foreign field (must not be an interface).
+     */
     private static final String FOREIGN_FIELD_INIT_TYPE_OPTION
         = "torque.om.complexObjectModel.foreignFieldInitType";
+
+    /**
+     * The name of the option which determines whether to generate
+     * java5 generics.
+     */
     private static final String JAVA5_OPTION
         = "torque.om.java5";
 

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
Sun Sep 12 20:30:01 2010
@@ -40,17 +40,21 @@ import org.apache.torque.templates.trans
  */
 public class OMTableTransformer extends AttributeTransformer
 {
+    /** The transformer for the column child elements. */
     private static OMColumnTransformer columnTransformer
             = new OMColumnTransformer();;
 
+    /** The transformer for the foreign keys referencing this table. */
     private static OMReferencingForeignKeyTableTransformer
             referencingForeignKeyTableTransformer
                 = new OMReferencingForeignKeyTableTransformer();
 
+    /** The transformer collecting the primary key columns in this table. */
     private static CollectAttributeSetTrueTransformer primaryKeyTransformer
             = new CollectAttributeSetTrueTransformer();
 
-    private static Camelbacker camelbacker = new Camelbacker();
+    /** The Camelbacker for producing the java name from the table name. */
+    private static Camelbacker javaNameCamelbacker = new Camelbacker();
 
     public OMTableTransformer() throws SourceTransformerException
     {
@@ -143,7 +147,7 @@ public class OMTableTransformer extends 
                         + tableElement.getName()
                         + " is null");
             }
-            javaName = camelbacker.process(inputName.toString());
+            javaName = javaNameCamelbacker.process(inputName.toString());
             tableElement.setAttribute(
                     TorqueSchemaAttributeName.JAVA_NAME,
                     javaName);

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java?rev=996384&r1=996383&r2=996384&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java
(original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableChildElementName.java
Sun Sep 12 20:30:01 2010
@@ -24,7 +24,7 @@ import org.apache.torque.generator.sourc
 /**
  * Contains the child elements for a table source element which are not
  * defined in the Torque schema. These elements might be created
- * in tre transformation
+ * in the transformation of a table.
  */
 public enum TableChildElementName implements SourceElementName
 {
@@ -33,8 +33,14 @@ public enum TableChildElementName implem
      */
     INHERITANCE_COLUMN("inheritance-column"),
 
+    /**
+     * Contains all foreign keys referencing this table.
+     */
     REFERENCING_FOREIGN_KEYS("referencing-foreign-keys"),
 
+    /**
+     * Contains all primary key columns of the table.
+     */
     PRIMARY_KEYS("primary-keys");
 
     /** The name of the source element, not null. */



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