I need a max function in my jstl, so i am writing a static function and exposing it in the tld as a jstl function.
The problem is, i dont know what type the arguments will be, int, long, double etc. Do i have to create a function for each data type?
or
Maybe i can just write the function for doubles, and pray that jstl will do the conversion for me?
edit2:
nevermind, i thought the tld definition would be as simple as T max(T,T) but this is not the case. i have no idea how to make a tld definition for the generic method. I guess ill just pray that the jsp will convert my type correctly and use Math.max(double, double)
Is it a max function like
Math.max()(take two parameters, return the greater), or something likeArrays.sort()(take an array, return the greatest).In the first case, JSP EL will coerce the arguments to the correct types if it is possible.
In the second case, a distinct method is needed for each primitive array component type you want to support.