Replacing Context.data with an interface

20 views
Skip to first unread message

Phil Waligora

unread,
Jun 7, 2017, 12:16:47 PM6/7/17
to handlebars.java
Hello,

We are attempting to integrate Handlebars into our core product. We have an existing data store which is essentially a Map. We would like to have Handlebars use this. However, the internal data store of Context is hard coded to be a HashMap.

This leaves us with two alternatives. We can copy the key/value pairs into the Context data Map, or we can define a new way of giving the data set for a Context.

I would like to define an interface ContextDataMap which provides get, put, putAll, and clear methods. The Context object would contain a ContextDataMap instance instead of a HashMap. The default for Context would use ContextDataMapImpl which defaults to a HashMap. Alternatively, the user could provide a different ContextDataMap.

This would allow us to use our existing data structure when wrapped inside the interface implementation.

Does anyone see any potential issues with this approach?

Thanks,
Phil

Phil Waligora

unread,
Jun 7, 2017, 12:25:36 PM6/7/17
to handlebars.java
I have created the following issue: https://github.com/jknack/handlebars.java/issues/586
Reply all
Reply to author
Forward
0 new messages