function-mapper"

From Documentation
m
m
Line 1: Line 1:
 
{{ZUMLReferencePageHeader}}
 
{{ZUMLReferencePageHeader}}
  
<source lang="xml" >
+
'''Syntax:'''
 
  <?function-mapper class="..."  
 
  <?function-mapper class="..."  
   [arg0="..."] [arg1="..."] [arg2="..."] [arg3="..."]?>
+
   [''arg0''="..."] [''arg1''="..."] [''arg2''="..."] [''arg3''="..."]?>
</source>
 
  
 
Specifies the function mapper that will be used by the EL expressions to resolve unknown function. The specified class must implement the <javadoc type="interface">org.zkoss.xel.FunctionMapper</javadoc> interface.
 
Specifies the function mapper that will be used by the EL expressions to resolve unknown function. The specified class must implement the <javadoc type="interface">org.zkoss.xel.FunctionMapper</javadoc> interface.
Line 14: Line 13:
 
== class ==
 
== class ==
  
<source lang="xml" >
+
[Optional]
[Optional]
 
</source>
 
  
 
A class name that must implement the <javadoc type="interface">org.zkoss.xel.FunctionMapper</javadoc> interface. Unlike the <tt>init</tt> directive, the class name cannot be the class that is defined in zscript codes.
 
A class name that must implement the <javadoc type="interface">org.zkoss.xel.FunctionMapper</javadoc> interface. Unlike the <tt>init</tt> directive, the class name cannot be the class that is defined in zscript codes.
Line 22: Line 19:
 
== arg0, arg1... ==
 
== arg0, arg1... ==
  
<source lang="xml" >
+
[Optional]
[Optional]
 
</source>
 
  
 
You could specify any number of arguments. If not specified, the default constructor is assumed. If specified, it will look for the constructor with the signature in the following order:
 
You could specify any number of arguments. If not specified, the default constructor is assumed. If specified, it will look for the constructor with the signature in the following order:
Line 32: Line 27:
 
# Foo()
 
# Foo()
  
If the first signature is found, the arguments with the name and value are passed to the constructor as an instance of <tt>Map</tt>. If the second signature is found, the values of arguments are passed to the constructor as an array of objects.
+
If the first signature is found, the arguments with the name and value are passed to the constructor as an instance of <tt>Map</tt>. If the second signature is found, the values of arguments are passed to the constructor as an array of objects. For example,
 
 
Prior to ZK 3.6.2, only the second signature is checked if one or more argument is specified, and it assumes <tt>arg0</tt> as the first argument, <tt>arg1</tt> as the second, and so on.
 
 
 
On the hand, you, with ZK 3.6.2 or later, can use any readable name for arguments as follows.
 
  
 
<source lang="xml">
 
<source lang="xml">
Line 42: Line 33:
 
</source>
 
</source>
  
==Version History==
+
Prior to ZK 3.6.2, only the second signature is checked if one or more argument is specified, and it assumes <tt>arg0</tt> as the first argument, <tt>arg1</tt> as the second, and so on.
 +
 
 +
=Version History=
  
 
{| border='1px' | width="100%"
 
{| border='1px' | width="100%"

Revision as of 11:00, 18 November 2010

Syntax:

<?function-mapper class="..." 
  [arg0="..."] [arg1="..."] [arg2="..."] [arg3="..."]?>

Specifies the function mapper that will be used by the EL expressions to resolve unknown function. The specified class must implement the FunctionMapper interface.

You can specify multiple variable resolvers with multiple function-mapper directives. The later declared one has higher priority.

Notice that the function-mapper directives are evaluated before the init directives.

class

[Optional]

A class name that must implement the FunctionMapper interface. Unlike the init directive, the class name cannot be the class that is defined in zscript codes.

arg0, arg1...

[Optional]

You could specify any number of arguments. If not specified, the default constructor is assumed. If specified, it will look for the constructor with the signature in the following order:

  1. Foo(Map args)
  2. Foo(Object[] args)
  3. Foo()

If the first signature is found, the arguments with the name and value are passed to the constructor as an instance of Map. If the second signature is found, the values of arguments are passed to the constructor as an array of objects. For example,

<?function-mapper class="foo.Foo" whatever="anything"?>

Prior to ZK 3.6.2, only the second signature is checked if one or more argument is specified, and it assumes arg0 as the first argument, arg1 as the second, and so on.

Version History

Version Date Content
     



Last Update : 2010/11/18

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.