How can my Java classes ask a template for information about its structure (e.g. a list of all the variables)?
In FreeMarker 2.2, Template has an undocumented method for examining the parsed template: getRootTreeNode. But listing all accessed variables is not possible, because variable names can be dynamically generated from data. However, there’s a more important reason why FreeMarker doesn’t support this. The design of FreeMarker is based on the idea of a separation between business objects and presentation objects.