Groovy Documentation

org.codehaus.groovy.grails.scaffolding
[Java] Interface GrailsTemplateGenerator


public interface GrailsTemplateGenerator

Defines methods for generating Grails artifacts from a domain class.

Authors:
Graeme Rocher
Since:
0.1


Method Summary
void generateController(GrailsDomainClass domainClass, java.lang.String destDir)

Generates a controller for the supplied domain class.

void generateController(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(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 generateView(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 generateViews(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

generateController

public void generateController(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


generateController

public void generateController(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


generateView

public void generateView(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

public void generateView(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


generateViews

public void generateViews(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


setOverwrite

public void setOverwrite(boolean shouldOverwrite)
Whether the generator should overwrite existing files (defaults to false).
Parameters:
shouldOverwrite - Whether views should be overwritten when generating


setResourceLoader

public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
The resource loader to use to load templates from.
Parameters:
resourceLoader - The ResourceLoader instance


 

Groovy Documentation