redora.generator
Class GeneratorTemplate

java.lang.Object
  extended by redora.generator.GeneratorTemplate

public class GeneratorTemplate
extends Object

The generator uses a bean-counterish template file located in /target/generated-resources/templates.xml (look it up in the sources). There are all the templates in use. You can override this template by adding your own templates.xml in your project's resources directory. Keep in mind that you have to track any changes in templates.xml (simply do a diff in Google Codes source browser). Check this diff whenever you upgrade a version of Redora.
By overriding this templates file, you can for example add newe templates that will be used by the generator. For example to create an client that uses SmartGWT or ExtJS, whatever you prefer of course.
This class handles this thing.

Author:
Nanjing RedOrange (http://www.red-orange.cn)

Constructor Summary
GeneratorTemplate(String templateDir)
           
 
Method Summary
 List<Template> byInput(Template.Input input)
           
 Template from(Node node)
          Will get a Template object form the templates.xml document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratorTemplate

public GeneratorTemplate(@NotNull
                         String templateDir)
                  throws ModelGenerationException
Parameters:
templateDir - (Mandatory).
Throws:
ModelGenerationException - If templates.xml cannot be found.
Method Detail

byInput

@NotNull
public List<Template> byInput(@NotNull
                                      Template.Input input)
                       throws ModelGenerationException
Parameters:
input - A value of the Input enum
Returns:
List of all the templates that use given input.
Throws:
ModelGenerationException - Wrapping XPath exceptions

from

@NotNull
public Template from(@NotNull
                             Node node)
Will get a Template object form the templates.xml document. This file is the generator dispatcher, telling the generator what to do with which template file (freemarker or xslt). You can create a custom templates.xml and change or extend the generator's behavior.

Returns:
Template class as holder of the information found in templates.xml


Copyright © 2012 Nanjing RedOrange Co. ltd. All Rights Reserved.