org.codehaus.groovy.grails.scaffolding
Interface GrailsTemplateGenerator


public interface GrailsTemplateGenerator

Defines methods for generating Grails artifacts from a domain class.

Since:
0.1
Author:
Graeme Rocher

Method Summary
 void generateController(GrailsDomainClass domainClass, String destDir)
          Generates a controller for the supplied domain class.
 void generateController(GrailsDomainClass domainClass, Writer out)
          Generates a controller for the specified domain class, writing the result to the specified java.io.Writer instance.
 void generateView(GrailsDomainClass domainClass, String viewName, String destDir)
          Generates a view for the specified domain class and view name to the target directory.
 void generateView(GrailsDomainClass domainClass, String viewName, 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(GrailsDomainClass domainClass, 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(ResourceLoader resourceLoader)
          The resource loader to use to load templates from.
 

Method Detail

setResourceLoader

void setResourceLoader(ResourceLoader resourceLoader)
The resource loader to use to load templates from.

Parameters:
resourceLoader - The ResourceLoader instance

generateViews

void generateViews(GrailsDomainClass domainClass,
                   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(GrailsDomainClass domainClass,
                        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(GrailsDomainClass domainClass,
                  String viewName,
                  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(GrailsDomainClass domainClass,
                  String viewName,
                  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(GrailsDomainClass domainClass,
                        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