PebbleTemplates / pebble

Java Template Engine
https://pebbletemplates.io
BSD 3-Clause "New" or "Revised" License
1.1k stars 168 forks source link

Template model #682

Open ndawod opened 3 months ago

ndawod commented 3 months ago

Hi there, and thanks for this fine piece of software! 🎉

I'm currently moving away from FreeMarker and I'm 99% sold on Pebble – except for one important factor (for me): Pebble expects the template model to be a Map<String, Object>, while FreeMarker doesn't. FreeMarker accepts any instance of a class, Map, List, String, anything really, and the template would work fine with it. But Pebble works only with a Map.

So, I wonder, how hard would it be to add an overload for evaluate() that accepts Object model? The easiest would probably be to convert the Object to a Map (via reflection) and then forward the call to the existing evaluate() method.