Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法可以将公共方法标记为“不可从速度模板调用”。
Velocity 将所有公共方法暴露给模板。没有办法隐藏它们。
标准方法是在上下文中使用类的外观。出于同样的原因,我们被迫这样做,但我们发现了立面的其他好处。例如,您可以通过组合几个方法来简化调用,或者您可以将值限制为某些参数,您不想对 Java 代码执行这些操作。