Overview Introduction Commands Hello World Examples Installation / Usage Eclipse Plugin Download |
JLoom is a modular template language for text generation, e.g. generation of source code, HTML, XML, etc. JSP like Syntax The syntax and semantics of JLoom templates are similar to Java Server Pages (JSP). If you already know JSP you will have no problem to write JLoom templates. Modularity JLoom doesn't have include-tags like JSP - which just insert other JSPs without encapsulation and parametrization. Instead of include-tags, JLoom supports modular composition of templates. Templates are full encapsulated like classes with parametrization and compiletime type-checking. Parameters are not restricted to String types - they can be any Java type, even Generics or Varargs. You can make a top-down/bottom-up design of the text-processing in your application. The modular templates strongly improve the maintainability of your code and eliminate redundancy. In addition you can organize your templates hierarchically in packages. And you can make modular extensions of the language with macros. Simplicity JLoom is easy to learn. The syntax is clean and uniform. Because it is build upon Java it can concentrate on its core function: building a bridge from Java to text-generation. If you are already familiar with Java syntax, there is not much to learn. The operators, rules for assignments and expressions are the same. And you can make use of the most recent Java (currently Java 1.5) syntax features, like Generics, Varargs, Autoboxing, etc. The basic syntax is simpler than JSP Syntax. But it is very powerful by allowing the definition of new syntax elements. This is done by writing macros, which are nothing else than JLoom templates themselves. The basic JLoom syntax is extended by such macros, e.g. all these commands are macros: exec, import, for, if, incIndent, decIndent. You can extend the language by writing your own custom macros, which are just JLoom templates - simple and powerful. Universality Like JSP, JLoom can be used to generate dynamic web content. And you can use both together: a JSP which accepts the HTTP requests, handles HTTP specific things like setting the content type and delegates the HTML generation to a JLoom template. But JLoom can be used for arbitrary purposes. Generating of source code (*), XML (alternative to XSLT), documentations, Emails, configuration files, scripts are just some other examples. Everywhere you have text-generation in your application, JLoom can help you to get an easy maintainable and extendable solution. (*) JLoom let you control the indention of the generated text - this is especially useful for code generation. JLoom uses itself (JLoom macros) to create the generator classes and therefore the generated Java code has correct indention. Efficiency JLoom generates text extremely fast. Like in JSP, JLoom generation is done in two phases. In the first phase the template is parsed and compiled into a Java class. This phase takes place only one time after creating/changing the template. Subsequent generations just "throw out" the text. If you are already familiar with JSP, you might want to make a quick start and take a look at the
|