Skip to content

Discussion: Use of template engine over custom solution #103

@Nava2

Description

@Nava2

This is not an issue, but a discussion as I've run into a bit of a road-block in my work.

Currently, the generator is configurable via changing the template values as shown here. The problem I'm having is that I want to add logic into these templates to, for example, generate a new assertion that is only relevant to my classes. If I want to do this, I have to write my own parser logic and call the required templates -- rather than just loading new templates.

I think one of the simplest ways to allow more flexibility is to remove the template engine from the generator and focus on using an existing engine with predefined templates. I believe the primary value of the generator is generating the model of assertions (e.g. ClassDescription) and their associating naming conventions to allow for generating these assertions. We can use this model within another engine to generate assertions

  • Apache FreeMarker - tried and true, works easily and is well known. Many features available. Additionally, uses a similar syntax for the "base" templates that we have already (${variable}).
  • jtwig - Neat new engine I've not heard of, but looks incredibly nice. Similar feature set
  • Thymeleaf - widely used, but I don't think it's well suited to work outside its domain of web generation

Looking for some input in this as I'm unsure if there were previously decisions made or after the fork it was just kept up as legacy. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions