1

I have a custom JSF function and I need to create a custom function that has a variable length argument list:

the signature is:

public static boolean myFunction(String... args) {
...
}

how do I write the signature of the function in the taglib file?

for example, if I have just one String argument, this works:

<function>
    <function-name>myFunction</function-name>
    <function-class>functions.Functions</function-class>
    <function-signature>boolean myFunction(java.lang.String)</function-signature>
</function>
Alina Danila
  • 1,683
  • 1
  • 24
  • 60
  • I have found myself the answer here: http://stackoverflow.com/questions/5033575/using-varargs-in-a-tag-library-descriptor. – Alina Danila May 03 '12 at 14:54

2 Answers2

1

Internally, a vararg argument like String... args is replaced by an array argument (String[] in this case).

Try:

<function-signature>boolean myFunction(java.lang.String[])</function-signature>
Torious
  • 3,364
  • 17
  • 24
0

It works fine when you take this approach: http://seamframework.org/Documentation/CreatingCustomELFunctions

The idea is to not define the functions explicitly, instead loading them dynamically from a static class into the library. Only problem for me is that Netbeans does not recognize the library this way.

Roben
  • 840
  • 9
  • 19