cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r602798 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main: java/org/apache/cayenne/gen/EntityUtils.java resources/dotemplates/v1_2/client-subclass.vm resources/dotemplates/v1_2/client-superclass.vm
Date Mon, 10 Dec 2007 07:39:05 GMT
Author: aadamchik
Date: Sun Dec  9 23:38:56 2007
New Revision: 602798

URL: http://svn.apache.org/viewvc?rev=602798&view=rev
Log:
CAY-926 Refactoring class generator classes
(cleanup)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-subclass.vm
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java?rev=602798&r1=602797&r2=602798&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/gen/EntityUtils.java
Sun Dec  9 23:38:56 2007
@@ -79,6 +79,9 @@
     /**
      * Returns class name (without a package) of the sub class associated with this
      * generator.
+     * 
+     * @deprecated since 3.0 This value is a part of velocity context and therefore is
+     *             redundant here.
      */
     public String getSubClassName() {
         return subClassName;
@@ -87,6 +90,9 @@
     /**
      * Returns the super class (without a package) of the data object class associated
      * with this generator
+     * 
+     * @deprecated since 3.0 This value is a part of velocity context and therefore is
+     *             redundant here.
      */
     public String getSuperClassName() {
         return superClassName;
@@ -95,6 +101,9 @@
     /**
      * Returns the base class (without a package) of the data object class associated with
      * this generator. Class name must not include a package.
+     * 
+     * @deprecated since 3.0 This value is a part of velocity context and therefore is
+     *             redundant here.
      */
     public String getBaseClassName() {
         return baseClassName;
@@ -102,6 +111,9 @@
 
     /**
      * Returns Java package name of the class associated with this generator.
+     * 
+     * @deprecated since 3.0 This value is a part of velocity context and therefore is
+     *             redundant here.
      */
     public String getSubPackageName() {
         return subPackageName;
@@ -110,6 +122,9 @@
     /**
      * Returns <code>superPackageName</code> property that defines a superclass's
      * package name.
+     * 
+     * @deprecated since 3.0 This value is a part of velocity context and therefore is
+     *             redundant here.
      */
     public String getSuperPackageName() {
         return superPackageName;
@@ -118,6 +133,9 @@
     /**
      * Returns <code>basePackageName</code> property that defines a baseclass's
      * (superclass superclass) package name.
+     * 
+     * @deprecated since 3.0 This value is a part of velocity context and therefore is
+     *             redundant here.
      */
     public String getBasePackageName() {
         return basePackageName;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-subclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-subclass.vm?rev=602798&r1=602797&r2=602798&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-subclass.vm
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-subclass.vm
Sun Dec  9 23:38:56 2007
@@ -23,19 +23,25 @@
 ##  Sub class - class of entity, ie, org.apache.cayenne.art.Artist
 ##
 ##  Classes available in template
-##    objEntity - the ObjEntity class: See org.apache.cayenne.map.ObjectEntity
+##    object (duplicated as 'objEntity') - the ObjEntity class: See org.apache.cayenne.map.ObjectEntity
 ##    stringUtils - class for string "helper" functions: See org.apache.cayenne.gen.StringUtils
 ##    entityUtils - class for entity "helper" functions: See org.apache.cayenne.gen.EntityUtils
 ##    importUtils - class for import statement management: See org.apache.cayenne.gen.ImportUtils
+##    superClassName
+##    superPackageName
+##    subClassName
+##    subPackageName
+##    baseClassName
+##    basePackageName 
 ##
-${importUtils.setPackage($entityUtils.subPackageName)}##
-${importUtils.addReservedType("${$entityUtils.subPackageName}.${entityUtils.subClassName}")}##
-${importUtils.addType("${entityUtils.superPackageName}.${entityUtils.superClassName}")}##
+${importUtils.setPackage($subPackageName)}##
+${importUtils.addReservedType("${$subPackageName}.${subClassName}")}##
+${importUtils.addType("${superPackageName}.${superClassName}")}##
 ${importUtils.generate()}
 
 /**
- * A persistent class mapped as "${objEntity.name}" Cayenne entity.
+ * A persistent class mapped as "${object.name}" Cayenne entity.
  */
-public class ${entityUtils.subClassName} extends ${entityUtils.superClassName} {
+public class ${subClassName} extends ${superClassName} {
 
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm?rev=602798&r1=602797&r2=602798&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/resources/dotemplates/v1_2/client-superclass.vm
Sun Dec  9 23:38:56 2007
@@ -21,20 +21,27 @@
 ##	Sub class - class of entity, ie, org.apache.cayenne.art.Artist
 ##
 ##  Classes available in template
-##    objEntity - the ObjEntity class: See org.apache.cayenne.map.ObjectEntity
+##    object (duplicated as 'objEntity') - the ObjEntity class: See org.apache.cayenne.map.ObjectEntity
 ##    stringUtils - class for string "helper" functions: See org.apache.cayenne.gen.StringUtils
 ##    entityUtils - class for entity "helper" functions: See org.apache.cayenne.gen.EntityUtils
 ##    importUtils - class for import statement management: See org.apache.cayenne.gen.ImportUtils
+##    superClassName
+##    superPackageName
+##    subClassName
+##    subPackageName
+##    baseClassName
+##    basePackageName 
 ##
 ##
-${importUtils.setPackage($entityUtils.superPackageName)}##
-${importUtils.addReservedType("${$entityUtils.superPackageName}.${entityUtils.superClassName}")}##
-${importUtils.addType("${entityUtils.basePackageName}.${entityUtils.baseClassName}")}##
-#foreach( $attr in ${objEntity.DeclaredAttributes} )
+${importUtils.setPackage($superPackageName)}##
+${importUtils.addReservedType("${$superPackageName}.${superClassName}")}##
+${importUtils.addType("${basePackageName}.${baseClassName}")}##
+#foreach( $attr in ${object.DeclaredAttributes} )
 $importUtils.addType(${attr.Type})##
 #end
-#foreach( $rel in ${objEntity.DeclaredRelationships} )
+#foreach( $rel in ${object.DeclaredRelationships} )
 $importUtils.addType(${rel.TargetEntity.ClientClassName})##
+$importUtils.addType(${rel.CollectionType})##
 #end
 #if( ${entityUtils.hasToOneDeclaredRelationships()} )
 ${importUtils.addType('org.apache.cayenne.ValueHolder')}##
@@ -42,34 +49,34 @@
 ${importUtils.generate()}
 
 /**
- * A generated persistent class mapped as "${objEntity.name}" Cayenne entity. It is a good
idea to
+ * A generated persistent class mapped as "${object.name}" Cayenne entity. It is a good idea
to
  * avoid changing this class manually, since it will be overwritten next time code is
  * regenerated. If you need to make any customizations, put them in a subclass.
  */
-public abstract class ${entityUtils.superClassName} extends ${entityUtils.baseClassName}
{
+public abstract class ${superClassName} extends ${baseClassName} {
 
 ## Create ivars names
-#foreach( $attr in ${objEntity.DeclaredAttributes} )
+#foreach( $attr in ${object.DeclaredAttributes} )
     public static final String ${stringUtils.capitalizedAsConstant($attr.Name)}_PROPERTY
= "${attr.Name}";
 #end
-#foreach( $rel in ${objEntity.DeclaredRelationships} )
+#foreach( $rel in ${object.DeclaredRelationships} )
     public static final String ${stringUtils.capitalizedAsConstant($rel.Name)}_PROPERTY =
"${rel.Name}";
 #end
 
 ## Create ivars
-#foreach( $attr in ${objEntity.DeclaredAttributes} )
+#foreach( $attr in ${object.DeclaredAttributes} )
     protected $importUtils.formatJavaType(${attr.Type}) ${attr.Name};
 #end
-#foreach( $rel in ${objEntity.DeclaredRelationships} )
+#foreach( $rel in ${object.DeclaredRelationships} )
 #if( $rel.ToMany )
-    protected ${rel.CollectionType} ${rel.Name};
+    protected $importUtils.formatJavaType($rel.CollectionType) ${rel.Name};
 #else
     protected ValueHolder ${rel.Name};
 #end
 #end
 
 ## Create attribute set/get methods
-#foreach( $attr in ${objEntity.DeclaredAttributes} )
+#foreach( $attr in ${object.DeclaredAttributes} )
     public $importUtils.formatJavaType(${attr.Type}) get${stringUtils.capitalized($attr.Name)}()
{
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "${attr.Name}", false);
@@ -77,7 +84,7 @@
         
         return ${attr.Name};
     }
-#if ("true" != "${objEntity.isReadOnly()}")
+#if ("true" != "${object.isReadOnly()}")
     public void set${stringUtils.capitalized($attr.Name)}($importUtils.formatJavaType(${attr.Type})
$stringUtils.formatVariableName(${attr.Name})) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "${attr.Name}", false);
@@ -98,9 +105,9 @@
 ##
 ##
 ## Create list add/remove/get methods
-#foreach( $rel in ${objEntity.DeclaredRelationships} )
+#foreach( $rel in ${object.DeclaredRelationships} )
 #if( $rel.ToMany )
-    public ${rel.CollectionType} get${stringUtils.capitalized($rel.Name)}() {
+    public $importUtils.formatJavaType($rel.CollectionType) get${stringUtils.capitalized($rel.Name)}()
{
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "${rel.Name}", true);
         }
@@ -148,7 +155,7 @@
         
         return ($importUtils.formatJavaType(${rel.TargetEntity.ClientClassName})) ${rel.Name}.getValue();
     }
-#if ( !${objEntity.isReadOnly()} && !$rel.ReadOnly )
+#if ( !${object.isReadOnly()} && !$rel.ReadOnly )
     public void set${stringUtils.capitalized($rel.Name)}(${importUtils.formatJavaType($rel.TargetEntity.ClientClassName)}
$stringUtils.formatVariableName(${rel.Name})) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "${rel.Name}", true);



Mime
View raw message