Actually Simon you just gave me the perfect example

Simon Kitching schrieb:

We are not talking about doing away with any existing templates, right?

No, the existing templates are not touched, what we have here is more or less an extension to java which adds multiline strings and string templating in a very generic way without colliding with the java syntax itself.


AIUI we're just talking about replacing a whole bunch of calls to
  responseWriter.startElement("span")
  responseWriter.write("hello," + planetName);
  responseWriter.endElement("span")
  etc

Actually the new code would look like

... do something in java here
/*TPL
#outputop(responseWriter.write)
<span> hello $planetName </span>
TPL*/

... do again something in java here...


It would not result in entirely the same code after the compile,
but with the current state of affairs more or less in following code:

responsewriter.write("<span> hello ");
responsewriter.write(planetName);
responsewriter.write(" </span>");

I do not cover the startElement stopElement, and attribute etc.. apis because I wanted to be as generic as possible (so that it can be covered outside of jsf. Theoretically it would be possible in the long run to cover those as well (by simply parsing the code which has to be printed in a second step for tag constructs). For now I leave it that way.


As I said in an earlier mail, I got the idea by groovy which has multiline strings and limited string templating, but I went for the comment syntax because I did not want to break existing java tooling. (Pretty much like the jboss guys did in their compiler, but on the xml side by using CDATA blocks to cover the java code)


I hope that clears things a little bit up.

Werner

Reply via email to