new"

From Documentation
 
Line 5: Line 5:
 
</source>
 
</source>
  
:i.e., <javadoc method="new_(java.lang.Object)">org.zkoss.xel.fn.CommonFns</javadoc>
+
:i.e. it calls <javadoc method="new_(java.lang.Object)">org.zkoss.xel.fn.CommonFns</javadoc>
  
 
Instantiates the given class. It assumes the given class has a default constructor.
 
Instantiates the given class. It assumes the given class has a default constructor.
Line 11: Line 11:
 
'''Paramters'''
 
'''Paramters'''
 
* cls - the class. It could be an instance of either String or Class.
 
* cls - the class. It could be an instance of either String or Class.
 +
 +
 +
= Usage =
 +
You can use it to convert a number to the correct type(class), <code>${c:int(1)}</code>.
 +
 +
Notice that a number specified in EL is interpreted as long by default. For example, in <code>${c:new('foo.Mine', 10)}</code>, 10 is interpreted as long. If you're using 5.0.5 and prior, you have to convert it to integer manually : <code>${c:new('foo.Mine', c:int(10))}</code>.
  
 
=Version History=
 
=Version History=
Line 20: Line 26:
 
| December 2010
 
| December 2010
 
| Automatically converted a number to the correct type (aka., class).
 
| Automatically converted a number to the correct type (aka., class).
Notice that a number specified in EL is interpreted as long, by default. For example, in <tt>${c:new('foo.Mine', 10)}</tt>, 10 is interpreted as long. If you're using 5.0.5 and prior, you have to convert it to integer manually : <tt>${c:new('foo.Mine', c:int(10))}</tt>.
 
 
|}
 
|}
  
 
{{ZUMLReferencePageFooter}}
 
{{ZUMLReferencePageFooter}}

Latest revision as of 03:14, 27 October 2021

Object new(Object cls);
i.e. it calls CommonFns.new_(Object)

Instantiates the given class. It assumes the given class has a default constructor.

Paramters

  • cls - the class. It could be an instance of either String or Class.


Usage

You can use it to convert a number to the correct type(class), ${c:int(1)}.

Notice that a number specified in EL is interpreted as long by default. For example, in ${c:new('foo.Mine', 10)}, 10 is interpreted as long. If you're using 5.0.5 and prior, you have to convert it to integer manually : ${c:new('foo.Mine', c:int(10))}.

Version History

Last Update : 2021/10/27


Version Date Content
5.0.6 December 2010 Automatically converted a number to the correct type (aka., class).



Last Update : 2021/10/27

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