Say I have a template in either pebble or freemarker (The two engines I am considering using). It might look something like this:
<Node>
<Element attribute="{{ VAR_A }}"/>
<Element attribute="{{ VAR_F }}"/>
<Element attribute="{{ VAR_N }}"/>
</Node>
In my Java code, I will need to provide an object containing these variables, which I believe can just be a map of variable name to object in both engines.
However to generate the data model, I need to know which variables to calculate values for. I have a lot of data. I don't want to calculate all of VAR_A, VAR_B, VAR_C, VAR_D, VAR_E, etc if they aren't going to be used.
Is there a way in either/both of these engines for getting a list of the required variables before executing the template? A way to do lazy evaluation of each attribute value
Edit: I have no idea what the template will look like when I have to evaluate it as it will be defined by the user. Even the variables they are providing will be user defined strings - which is why I need to get (and analyse) them before I can provide the data.