Fix for "import java.util.List;" in superclass.vm template

From: Mike Kienenberger (mkienen..laska.net)
Date: Mon Sep 08 2003 - 22:09:50 EDT

  • Next message: Mike Kienenberger: "Re: [SOLVED] (but not understood) class generator not substituting formatVariableName correctly with custom supertemplate"

    List needs to be conditionally included in the current superclass.vm
    template.
    Here's code that will do it (ugly as it may be), replacing everything
    starting at the beginning of the file to the /** Class comment (in order to
    show the #end whitespace adjustment)

    -Mike

    =======================
    #if( ${classGen.isUsingPackage()} )
    package ${classGen.packageName};
    #end

    ## import.java.util.List if there are any to-many relationships
    #set( $flagVariableHasToManyRelationships = 0 )
    #foreach( $rel in ${classGen.Entity.Relationships} )
    #set( $classGen.Prop = $rel.Name )## let controller know about current
    property
    #if( $rel.ToMany )
    #set( $flagVariableHasToManyRelationships = 1 )
    #end
    #end
    #if( 0 != $flagVariableHasToManyRelationships )
    import java.util.List;

    #end
    /** Class ${classGen.superPrefix}${classGen.className} was generated by
    Cayenne.
    =======================



    This archive was generated by hypermail 2.0.0 : Mon Sep 08 2003 - 22:07:08 EDT