Hi, Here is my requirement. I have a list of function objects in java
that I can put into my velocity context. All these functions (methods)
take one parameter each. I also have this list of parameters that the
functions take. I need to be able to print the invoked return value of
these methods into my output file.
As an example, assume my functions are:
functions = {'getName', 'getAge','getSalary'...};
parameters = {'John','Joe','Jack','Mary'...}
and I want the output to be of the following format:
getName('John') = John Smith
getName('Joe') = Joe Doe
.
.
.
getAge('Jack') = 36
.
.
.
getSalary('Mary') = 30000
.
.
.
and so on. I hope my predicament is clear. The left hand side of the
output lines are easy ($function.name, $parameter.name etc.) However,
the right hand side is dynamic and actually depends on the runtime
evaluated output value of invoking $function on $parameter. What are the
various ways in which I can do this? What would my template look like?
#foreach ($function in $functions)
#foreach ($parameter in $parameters)
$function.name('$parameter.name') = ## ???? WHAT COMES HERE?
#end
#end
Thanks for the help in advance.
regards,
Sriram Gopalan