org.codehaus.groovy.grails.scaffolding
Interface GrailsTemplateGenerator


public interface GrailsTemplateGenerator

Defines methods for generating Grails artifacts from a domain class.

Since:
0.1

Method Summary
 void generateController(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, java.lang.String destDir)
          Generates a controller for the supplied domain class.
 void generateController(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, java.io.Writer out)
          Generates a controller for the specified domain class, writing the result to the specified java.io.Writer instance.
 void generateView(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, java.lang.String viewName, java.lang.String destDir)
          Generates a view for the specified domain class and view name to the target directory.
 void generateView(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, java.lang.String viewName, java.io.Writer out)
          Generates a view for the specified domain class and view name writing the result to the specified java.io.Writer instance.
 void generateViews(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, java.lang.String destDir)
          Generates the necessary views for the supplied domain class.
 void setOverwrite(boolean shouldOverwrite)
          Whether the generator should overwrite existing files (defaults to false).
 void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
          The resource loader to use to load templates from.
 

Method Detail

setResourceLoader

void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
The resource loader to use to load templates from.

Parameters:
resourceLoader - The ResourceLoader instance

generateViews

void generateViews(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass,
                   java.lang.String destDir)
Generates the necessary views for the supplied domain class.

Parameters:
domainClass - The DomainClass to generate views for
destDir - The destination directory to generate views to

generateController

void generateController(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass,
                        java.lang.String destDir)
Generates a controller for the supplied domain class.

Parameters:
domainClass - The DomainClass to generate views for
destDir - The destination directory to generate views to

setOverwrite

void setOverwrite(boolean shouldOverwrite)
Whether the generator should overwrite existing files (defaults to false).

Parameters:
shouldOverwrite - Whether views should be overwritten when generating

generateView

void generateView(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass,
                  java.lang.String viewName,
                  java.io.Writer out)
Generates a view for the specified domain class and view name writing the result to the specified java.io.Writer instance.

Parameters:
viewName - The name of the view
out - The writer to write to
domainClass - The domain class to generate views for

generateView

void generateView(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass,
                  java.lang.String viewName,
                  java.lang.String destDir)
Generates a view for the specified domain class and view name to the target directory.

Parameters:
domainClass - The domain class
viewName - The view name
destDir - The destination

generateController

void generateController(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass,
                        java.io.Writer out)
Generates a controller for the specified domain class, writing the result to the specified java.io.Writer instance.

Parameters:
domainClass - The domain class to generate a controller for
out - The Writer to write to