[ 
https://issues.apache.org/jira/browse/VELOCITY-787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claude Brisson closed VELOCITY-787.
-----------------------------------
    Resolution: Won't Fix

To summerize Nathan and Christoph comments: outside the scope of Velocity. I 
agree.

> Write to multiple files, controlled by template directives
> ----------------------------------------------------------
>
>                 Key: VELOCITY-787
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-787
>             Project: Velocity
>          Issue Type: New Feature
>          Components: Engine
>    Affects Versions: 2.x
>         Environment: All environments
>            Reporter: Don Mendelson
>         Attachments: FileTool.java
>
>
> For some purposes, such as code generation, it would be very desirable to 
> output to multiple files from the same context. For example, to generate code 
> for a C++ class, two files must be generated - a header and implementation 
> file. Rendering could be driven by the same context in both cases, which 
> would desribe the class name, method signatures, etc. Currently this must be 
> done by running the engine twice - once with a header template and again with 
> an implementation file template.
> Furthermore, it would desirable to determine the output file names during 
> rendering, based on a combination of template directives and data in the 
> context. To use the code generation example, the header and implementation 
> file names would be determined by the name of the class to be generated.
> This is not possible with the current method signature of Directive: 
>     public boolean render(InternalContextAdapter context, Writer writer, Node 
> node) 
> An output directive would want to change the writer to a different instance 
> of FileWriter, for instance. But since Java passes object references by 
> value, the writer object cannot be replaced.
> The proposal is to provide a method to install a new instance of Writer 
> during rendering of a template. This would support both writing multiple 
> outputs in one run of the engine as well as controlling the file names of the 
> outputs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to