evaluator"

From Documentation
 
(17 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== The evaluator Directive ==
+
{{ZUMLReferencePageHeader}}
  
<source lang="xml" >
+
__TOC__
 +
 
 +
'''Syntax:'''
 
  <?evaluator [name="..."] [class="..."] [import="..."]?>
 
  <?evaluator [name="..."] [class="..."] [import="..."]?>
</source>
 
  
 
It specifies how to evaluate XEL expressions.
 
It specifies how to evaluate XEL expressions.
  
== name ==
+
= name =
  
<source lang="xml" >
+
[Optional][Default: ''none''][Case insensitive]
[optional][Default: ''none''][Case insensitive]
 
</source>
 
  
 
The name of the implementation used to evaluate the XEL expressions. There are two ways to specify the implementation. One is the name attribute. The other is the class attribute.
 
The name of the implementation used to evaluate the XEL expressions. There are two ways to specify the implementation. One is the name attribute. The other is the class attribute.
Line 24: Line 23:
 
</source>
 
</source>
  
Here are a list of built-in implementations.
+
Here is a list of built-in implementations:
 
 
  
{| border="1"
+
{| class='wikitable'
 
! <center>Name</center>
 
! <center>Name</center>
 
! <center>Class / Description</center>
 
! <center>Class / Description</center>
Line 35: Line 33:
 
|  org.zkoss.xel.el.ELFactory
 
|  org.zkoss.xel.el.ELFactory
  
The default implementation. It is based on ZK Commons EL (<tt>zcommons-el.jar</tt>), which is a performance enhancement version of Apache Commons EL.
+
The default implementation. It is based on ZK Commons EL (<code>zcommons-el.jar</code>), which is a performance enhancement version of Apache Commons EL.
 +
 
 +
|-
 +
|  zel
 +
|  org.zkoss.xel.zel.ELFactory
 +
 
 +
The implementation based on The ZK EL Library(<code>zel.jar</code>), which supports new features seen in <i>Unified Expression Language 2.2</i> such as method calls and l-value.
 +
 
 +
<source lang="xml">
 +
''[Since ZK 6, ZK uses this evaluator as the default one.]''
 +
</source>
  
 
|-
 
|-
Line 61: Line 69:
 
|  org.zkoss.zkmax.xel.el.ApacheELFactory
 
|  org.zkoss.zkmax.xel.el.ApacheELFactory
  
The implementation that is based on Apache Commons EL, <tt>org.apache.commons.el.ExpressionEvaluatorImpl</tt>.
+
The implementation that is based on Apache Commons EL, org.apache.commons.el.ExpressionEvaluatorImpl.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 71: Line 79:
 
|  org.zkoss.zkmax.xel.el21.ApacheELFactory
 
|  org.zkoss.zkmax.xel.el21.ApacheELFactory
  
The implementation that is based on Apache JSP 2.1 EL, <tt>org.apache.el.ExpressionFactoryImpl</tt>.
+
The implementation that is based on Apache JSP 2.1 EL, org.apache.el.ExpressionFactoryImpl.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 78: Line 86:
  
 
|}
 
|}
You can provide additional implementations by use of the <tt>class</tt> attribute, as described in the following section. The class must implement the <javadoc type="interface">org.zkoss.xel.ExpressionFactory</javadoc> interface. Or, you can specify the following content in <tt>metainfo/xel/config.xml</tt>.
+
You can provide additional implementation by the use of the <code>class</code> attribute, as described in the following section. The class must implement the <javadoc type="interface">org.zkoss.xel.ExpressionFactory</javadoc> interface. Or, you can specify the following content in <code>metainfo/xel/config.xml</code>.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 92: Line 100:
 
<references/>
 
<references/>
  
 
+
= class =
== class ==
+
[Optional][Default: ''dependind on how xel-config is specified'']
 
 
<source lang="xml" >
 
[Optional][Default: ''dependind on how xel-config is specified'']
 
</source>
 
  
 
The implementation used to evaluate the XEL expressions. In addition to the name attribute, you can specify the class directly. For example, you can use MVEL by specifying class as follows.
 
The implementation used to evaluate the XEL expressions. In addition to the name attribute, you can specify the class directly. For example, you can use MVEL by specifying class as follows.
Line 108: Line 112:
 
</source>
 
</source>
  
== import ==
+
= import =
  
<source lang="xml" >
+
[Optiona][Default: ''what are defined in taglib'']
[Optiona][Default: ''what are defined in taglib'']
 
</source>
 
  
 
Specifies a list of classes separated with comma to import for evaluating the expression in this page. For example, with MVEL:
 
Specifies a list of classes separated with comma to import for evaluating the expression in this page. For example, with MVEL:
Line 124: Line 126:
 
</source>
 
</source>
  
Notice that not all evaluators support the import of classes. For example, all EL-based the evaluators, including the system default one, don't support it. In other words, the <tt>import</tt> attribute is meaningless to them. Rather, you have to use the <tt>taglib</tt> directive to import functions.
+
Notice that not all evaluators support the import of classes. For example, all EL-based the evaluators, including the system default one, do ''not'' support it. In other words, the <code>import</code> attribute is meaningless to them (since they don't have the concept of instantiation).
 +
 
 +
In addition, the class's names specified in the import attribute must be a fully qualified name (including the package's name). In other words, it ignores the classes imported by [[ZUML Reference/ZUML/Processing Instructions/import|the import directive]].
 +
 
 +
=Version History=
 +
 
 +
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| 6.0.0
 +
| September 2011
 +
| Support those new features seen in Unified Expression Language 2.2 such as method calls and l-value.
 +
|}
 +
 
 +
{{ZUMLReferencePageFooter}}

Latest revision as of 06:10, 17 May 2022

Syntax:

<?evaluator [name="..."] [class="..."] [import="..."]?>

It specifies how to evaluate XEL expressions.

name

[Optional][Default: none][Case insensitive]

The name of the implementation used to evaluate the XEL expressions. There are two ways to specify the implementation. One is the name attribute. The other is the class attribute.

For example, if you want to use MVEL[1], you can specify the name as follows.

 <?evaluator name="mvel"?>
 <window id="w" title="MVEL Demo">
     ${new org.zkoss.zul.Textbox().setParent(w)}
 </window>

Here is a list of built-in implementations:

Name
Class / Description
default org.zkoss.xel.el.ELFactory

The default implementation. It is based on ZK Commons EL (zcommons-el.jar), which is a performance enhancement version of Apache Commons EL.

zel org.zkoss.xel.zel.ELFactory

The implementation based on The ZK EL Library(zel.jar), which supports new features seen in Unified Expression Language 2.2 such as method calls and l-value.

''[Since ZK 6, ZK uses this evaluator as the default one.]''
mvel org.zkoss.zkmax.xel.mvel.MVELFactory

The implementation based on MVEL, http://mvel.codehaus.org.

''[available only if zkmax.jar is loaded]''
ognl org.zkoss.zkmax.xel.ognl.OGNLFactory

The implementation based on OGNL, http://www.ognl.org.

''[available only if zkmax.jar is loaded]''
commons-el org.zkoss.zkmax.xel.el.ApacheELFactory

The implementation that is based on Apache Commons EL, org.apache.commons.el.ExpressionEvaluatorImpl.

''[available only if zkmax.jar is loaded]''
japser-el org.zkoss.zkmax.xel.el21.ApacheELFactory

The implementation that is based on Apache JSP 2.1 EL, org.apache.el.ExpressionFactoryImpl.

''[available only if zkmax.jar is loaded]''

You can provide additional implementation by the use of the class attribute, as described in the following section. The class must implement the ExpressionFactory interface. Or, you can specify the following content in metainfo/xel/config.xml.

 <config>
     <xel-config>
         <evaluator-name>Super</evaluator-name><!-- case insensitive -->
         <evaluator-class>my.SuperEvaluator</evaluator-class>
     </xel-config>
 </config>

Notes

  1. MVEL is a powerful expression language. Refer to http://mvel.codehaus.org/ for more information.

class

[Optional][Default: dependind on how xel-config is specified]

The implementation used to evaluate the XEL expressions. In addition to the name attribute, you can specify the class directly. For example, you can use MVEL by specifying class as follows.

 <?evaluator class="org.zkoss.zkmax.xel.mvel.MVELFactory"?>
 <window id="w" title="MVEL Demo">
     ${new org.zkoss.zul.Textbox().setParent(w)}
 </window>

import

[Optiona][Default: what are defined in taglib]

Specifies a list of classes separated with comma to import for evaluating the expression in this page. For example, with MVEL:

 <?evaluator class="org.zkoss.zkmax.xel.mvel.MVELFactory"
 import="org.zkoss.zul.Datebox,org.zkoss.zul.Combobox"?>
 <window id="w" title="MVEL Demo">
     ${new Datebox().setParent(w)}
 </window>

Notice that not all evaluators support the import of classes. For example, all EL-based the evaluators, including the system default one, do not support it. In other words, the import attribute is meaningless to them (since they don't have the concept of instantiation).

In addition, the class's names specified in the import attribute must be a fully qualified name (including the package's name). In other words, it ignores the classes imported by the import directive.

Version History

Version Date Content
6.0.0 September 2011 Support those new features seen in Unified Expression Language 2.2 such as method calls and l-value.



Last Update : 2022/05/17

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