public interface ISourceCodeEnhancer
Allow user application or more probably a framework plugin based on rythm to inject common import statements, render arguments and source code into generated java source code
| Modifier and Type | Interface and Description |
|---|---|
static class |
ISourceCodeEnhancer.INSTS
This is used by
RythmConfiguration and user application should not use this static member |
| Modifier and Type | Method and Description |
|---|---|
Map<String,?> |
getRenderArgDescriptions()
Return implicit render args type information indexed by render arg name.
|
List<String> |
imports()
Return a list of import statement to be injected into the generated java source code.
|
void |
setRenderArgs(ITemplate template)
Set implicit render arg values to a
template instance. |
String |
sourceCode()
Return source code to be added to template class.
|
List<String> imports()
Return a list of import statement to be injected into the generated java source code.
Note, only package declaration part needs to be put inside the Strings. the import directive is not required. E.g.
List ls = new ArrayList(); ls.put(“models.*”); ls.put("controllers.*); This method is called by rythm when generating java source code out from a template souce code
String sourceCode()
Return source code to be added to template class. This method is called during code generation to inject customized source code into final generated template source. The string returned will be injected into the generated template source code class body directly
Map<String,?> getRenderArgDescriptions()
Return implicit render args type information indexed by render arg name. The type info could be either a Class instance or a String of the class name. E.g, if the implicit render args are
Map<String, Object> descs = new HashMap<String, Object>(); descs.put("_play“, play.Play.class); // arg type with Class instance descs.put(”request“, ”play.mvc.Request"); // arg type with class name The method is called when code builder generating the java source out from the template source
void setRenderArgs(ITemplate template)
Set implicit render arg values to a template instance. Usually inside this method, the implicit arguments to be set should be corresponding to the render args described in getRenderArgDescriptions() method. E.g.
template.__setRenderArg("_play“, new play.Play()); template.__setRenderArg(”request", play.mvc.Request.current()); This method is called before rythm engine start to execute a template instance
template - Copyright © 2017–2021 OSGL (Open Source General Library). All rights reserved.