cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r602458 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen: ClassGenerationAction.java ClassGenerationAction1_1.java
Date Sat, 08 Dec 2007 12:52:52 GMT
Author: aadamchik
Date: Sat Dec  8 04:52:51 2007
New Revision: 602458

URL: http://svn.apache.org/viewvc?rev=602458&view=rev
Log:
CAY-926 Refactoring class generator classes
(cleanup - removing more fluff from the ClassGenerationAction)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java?rev=602458&r1=602457&r2=602458&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
Sat Dec  8 04:52:51 2007
@@ -306,8 +306,8 @@
         // return writer with specified encoding
         FileOutputStream out = new FileOutputStream(outFile);
 
-        return (getEncoding() != null)
-                ? new OutputStreamWriter(out, getEncoding())
+        return (encoding != null)
+                ? new OutputStreamWriter(out, encoding)
                 : new OutputStreamWriter(out);
     }
 
@@ -388,7 +388,7 @@
      * this class generator.
      */
     protected boolean isOld(File file) {
-        return file.lastModified() <= getTimestamp();
+        return file.lastModified() <= timestamp;
     }
 
     /**
@@ -432,26 +432,11 @@
         return (superTemplate != null) ? superTemplate : defaultSuperclassTemplate();
     }
 
-    /**
-     * Returns internal timestamp of this generator used to make decisions about
-     * overwriting individual files.
-     */
-    public long getTimestamp() {
-        return timestamp;
-    }
-
     public void setTimestamp(long timestamp) {
         this.timestamp = timestamp;
     }
 
     /**
-     * Returns file encoding for the generated files.
-     */
-    public String getEncoding() {
-        return encoding;
-    }
-
-    /**
      * Sets file encoding. If set to null, default system encoding will be used.
      */
     public void setEncoding(String encoding) {
@@ -459,14 +444,6 @@
     }
 
     /**
-     * Returns "superPkg" property value - a name of a superclass package that should be
-     * used for all generated superclasses.
-     */
-    public String getSuperPkg() {
-        return superPkg;
-    }
-
-    /**
      * Sets "superPkg" property value.
      */
     public void setSuperPkg(String superPkg) {
@@ -474,21 +451,10 @@
     }
 
     /**
-     * @return Returns the dataMap.
-     */
-    public DataMap getDataMap() {
-        return dataMap;
-    }
-
-    /**
      * @param dataMap The dataMap to set.
      */
     public void setDataMap(DataMap dataMap) {
         this.dataMap = dataMap;
-    }
-
-    public Collection<ObjEntity> getEntities() {
-        return entities;
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java?rev=602458&r1=602457&r2=602458&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/ClassGenerationAction1_1.java
Sat Dec  8 04:52:51 2007
@@ -75,28 +75,15 @@
                     + superGen.getClassName());
 
             if (superOut != null) {
-                superGenerator.generateClass(
-                        superOut,
-                        getDataMap(),
-                        entity,
-                        null,
-                        null,
-                        null);
+                superGenerator.generateClass(superOut, dataMap, entity, null, null, null);
                 superOut.close();
             }
 
             // 2. do the main class
             initClassGenerator(mainGen, entity, false);
-            Writer mainOut = openWriter(mainGen.getPackageName(), mainGen
-                    .getClassName());
+            Writer mainOut = openWriter(mainGen.getPackageName(), mainGen.getClassName());
             if (mainOut != null) {
-                mainGenerator.generateClass(
-                        mainOut,
-                        getDataMap(),
-                        entity,
-                        null,
-                        null,
-                        null);
+                mainGenerator.generateClass(mainOut, dataMap, entity, null, null, null);
                 mainOut.close();
             }
         }
@@ -111,14 +98,14 @@
         for (ObjEntity entity : entitiesForCurrentMode()) {
 
             initClassGenerator(generator.getClassGenerationInfo(), entity, false);
-            Writer out = openWriter(generator
-                    .getClassGenerationInfo()
-                    .getPackageName(), generator.getClassGenerationInfo().getClassName());
+            Writer out = openWriter(
+                    generator.getClassGenerationInfo().getPackageName(),
+                    generator.getClassGenerationInfo().getClassName());
             if (out == null) {
                 continue;
             }
 
-            generator.generateClass(out, getDataMap(), entity, null, null, null);
+            generator.generateClass(out, dataMap, entity, null, null, null);
             out.close();
         }
     }



Mime
View raw message