Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change initialization of JinjavaInterpreter to instantiation #347

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

Roobun
Copy link
Contributor

@Roobun Roobun commented Jun 26, 2019

Now it's possible to override instantiate method
It'll be helpful if you use extended interpreter

@mattcoley
Copy link
Collaborator

I believe you will also have to look at https://github.com/HubSpot/jinjava/blob/master/src/main/java/com/hubspot/jinjava/Jinjava.java which also creates interpreters.

@mattcoley
Copy link
Collaborator

Maybe we can use a factory pattern for the JinjavaInterpreter and set the factory on the JinjavaConfig. So there would be some interface InterpreterFactory with a default JinjavaInterpreterFactory that is set as a field on JinjavaConfig. Everywhere we create a new interpreter would instead use config.getInterpreterFactory().newInstance(...). You could then create your own factory to serve your own interpreters and set that value in the config.

@Roobun
Copy link
Contributor Author

Roobun commented Jul 11, 2019

Maybe we can use a factory pattern for the JinjavaInterpreter and set the factory on the JinjavaConfig. So there would be some interface InterpreterFactory with a default JinjavaInterpreterFactory that is set as a field on JinjavaConfig. Everywhere we create a new interpreter would instead use config.getInterpreterFactory().newInstance(...). You could then create your own factory to serve your own interpreters and set that value in the config.

Sure. Please take a look at new changes I added.

Copy link
Collaborator

@mattcoley mattcoley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@mattcoley
Copy link
Collaborator

I'll merge and do a release

@mattcoley mattcoley merged commit a96ebf9 into HubSpot:master Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants