FreeMarker如何找到对应的java类
我正在调查使用 FreeMarker 的大型项目。我是 FreeMarker 的新手。我如何找到哪些 java 类用于接收模板值?调查所有项目似乎是一项巨大的工作。 谢谢。 Eclipse 可能需要一些插件吗?
I am investigating large project that uses FreeMarker. I am newbie to FreeMarker. How I can find which classes of java are used to receive values for templates? Investigate all project seems enormous work.
Thanks.
May be need some plugins for Eclipse?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FreeMarker 是一种典型的“动态语言”,这意味着重构/更改很困难。模板没有声明它们期望在数据模型中包含什么。此外,当模板尝试从数据模型中读取值时(例如
${foo.bar}
),它可能意味着foo.get("bar")
或 foo.getBar() 或任何使用的 ObjectWrapper 使之成为可能,并且仅在执行模板时决定。当然,如果您更改某些内容,您将需要退回到老式的搜索和替换以及大量测试(一个好的测试套件至关重要......)。当然,您可以查看程序中构建数据模型的位置,并查看其中放入的内容。或者在运行时以某种方式转储数据模型。FreeMarker is a typical "dynamic language", which means refactoring/changing is hard. The templates don't declare what they expect to be in the data-model. Furthermore, when a template tries to read a value from the data-model, like with
${foo.bar}
, it could meanfoo.get("bar")
orfoo.getBar()
or whatever theObjectWrapper
used makes possible, and it's only decided when the template is executed. Certainly you will need to fall back to good-old search-and-replace and lot of testing (a good test suite is essential...) if you change something. And of course, you could look at the place in the program where the data-model is built, and see what was put into it. Or dump the data-model somehow on runtime.