Velocity: hide methods from template
-
12-09-2019 - |
Question
Is there a way I can mark a public method as "not callable from a velocity template".
Solution
Velocity exposes all public methods to the template. There is no way to hide them.
The standard approach for this is to use a facade to your class in the context. We were forced to do this for the same reason but we found other benefits with a facade. For example, you can simplify the call by combining several methods, or you can restrict values to certain arguments, which you don't want do to your Java code.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow