<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.biouml.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.biouml.org/index.php?action=history&amp;feed=atom&amp;title=Function_%28extension_point%29</id>
		<title>Function (extension point) - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.biouml.org/index.php?action=history&amp;feed=atom&amp;title=Function_%28extension_point%29"/>
		<link rel="alternate" type="text/html" href="https://wiki.biouml.org/index.php?title=Function_(extension_point)&amp;action=history"/>
		<updated>2026-04-26T05:06:54Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.3</generator>

	<entry>
		<id>https://wiki.biouml.org/index.php?title=Function_(extension_point)&amp;diff=4571&amp;oldid=prev</id>
		<title>Lan@dote.ru: From Help&amp;Manual</title>
		<link rel="alternate" type="text/html" href="https://wiki.biouml.org/index.php?title=Function_(extension_point)&amp;diff=4571&amp;oldid=prev"/>
				<updated>2013-06-17T08:13:49Z</updated>
		
		<summary type="html">&lt;p&gt;From Help&amp;amp;Manual&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Extension point|function|ru.biosoft.plugins.javascript}}&lt;br /&gt;
== Description ==&lt;br /&gt;
Using this extension plug-in can define JavaScript functions that will be available from JavaScipt shell. Plug-in functions will be shown under analyses/JavaScript/functions section in [[repository]] tree. Function help will be shown in [[information box]] when the function item will be selected in repository tree.&lt;br /&gt;
&lt;br /&gt;
When the JavaScript function is called the specified by extension class method will be invoked. The METHOD must match one of two forms: with  fixed or variable number of arguments.&lt;br /&gt;
&lt;br /&gt;
=== Fixed arguments number ===&lt;br /&gt;
The first form is a member with zero or more parameters of the following types: {{Class|org.mozilla.javascript.Scriptable}}, {{Class|java.lang.Object}}, {{Class|java.lang.String}}, boolean, byte, short, int, float, or double. The long type is not supported because the double representation of a long (which is the EMCA-mandated storage type for Numbers) may lose precision. The return value must be void or one of the types allowed for parameters.&lt;br /&gt;
&lt;br /&gt;
The runtime will perform appropriate conversions based upon the type of the parameter. A parameter type of {{Class|java.lang.Object}} specifies that no conversions are to be done. A parameter of type {{Class|java.lang.String}} will use {{Method|org.mozilla.javascript.Context.toString}} to convert arguments. Similarly, parameters of type double, boolean, and {{Class|org.mozilla.javascript.Scriptable}} will cause {{Method|org.mozilla.javascript.Context.toNumber}}, {{Method|org.mozilla.javascript.Context.toBoolean}}, and {{Method|org.mozilla.javascript.Context.toObject}}, respectively, to be called.&lt;br /&gt;
&lt;br /&gt;
If the method is not static, the Java 'this' value will correspond to the JavaScript 'this' value. Any attempt to call the function with a 'this' value that is not of the right Java type will result in an error.&lt;br /&gt;
&lt;br /&gt;
=== Variable arguments number ===&lt;br /&gt;
The second form is the variable arguments (or &amp;quot;varargs&amp;quot;) form. The method must be a static Java method with parameters:&lt;br /&gt;
&lt;br /&gt;
 (Context cx, Scriptable thisObj, Object[] args, Function funObj) &lt;br /&gt;
&lt;br /&gt;
;args&lt;br /&gt;
:parameter contains the arguments&lt;br /&gt;
;thisObj&lt;br /&gt;
:is the JavaScript 'this' value&lt;br /&gt;
;funObj&lt;br /&gt;
:is the function object for the invoked function.&lt;br /&gt;
&lt;br /&gt;
The Java method should return an {{Class|java.lang.Object}} result.&lt;br /&gt;
&lt;br /&gt;
== Configuration Markup ==&lt;br /&gt;
 &amp;lt;!ELEMENT function (argument*, doc?)&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST function&amp;gt;&lt;br /&gt;
    name              CDATA   #REQUIRED&lt;br /&gt;
    class             CDATA   #REQUIRED&lt;br /&gt;
    method            CDATA   #REQUIRED&lt;br /&gt;
    varargs           CDATA   &amp;quot;false&amp;quot;&lt;br /&gt;
    javadoc           CDATA&lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;argument&lt;br /&gt;
:function arguments.&lt;br /&gt;
;doc&lt;br /&gt;
:the function description (documentation).&lt;br /&gt;
&lt;br /&gt;
;name&lt;br /&gt;
:the function name (how it will be used JavaScript).&lt;br /&gt;
;class&lt;br /&gt;
:the fully-qualified name of a class that provides corresponding static method.&lt;br /&gt;
;member&lt;br /&gt;
:the method or constructor that will be invoked to process the function call.&lt;br /&gt;
;varargs&lt;br /&gt;
:indicates the function form: fixed or variable argument number.&lt;br /&gt;
;javadoc&lt;br /&gt;
:URL to javadoc for the function description.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT argument&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST argument&amp;gt;&lt;br /&gt;
    class             CDATA   #REQUIRED&lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;class&lt;br /&gt;
:the fully-qualified name of a argument type.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT doc (argument*, returns?, throws*, example*)&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST doc&amp;gt;&lt;br /&gt;
      description       CDATA   #REQUIRED&lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;argument&lt;br /&gt;
:function argument description.&lt;br /&gt;
;returns&lt;br /&gt;
:description of the function result.&lt;br /&gt;
;throws&lt;br /&gt;
:description of exceptions that can be thrown by the function.&lt;br /&gt;
;example&lt;br /&gt;
:usage examples.&lt;br /&gt;
&lt;br /&gt;
;description&lt;br /&gt;
:function description.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT argument&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST argument&amp;gt;&lt;br /&gt;
    name             CDATA   #REQUIRED&lt;br /&gt;
    type             CDATA   #REQUIRED&lt;br /&gt;
    obligatory       CDATA   &amp;quot;true&amp;quot;&lt;br /&gt;
    description      CDATA   &lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;name&lt;br /&gt;
:the argument name.&lt;br /&gt;
;type&lt;br /&gt;
:the argument type.&lt;br /&gt;
;obligatory&lt;br /&gt;
:indicates whether the argument is obligatory.&lt;br /&gt;
;description&lt;br /&gt;
:the argument description.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT returns&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST returns&amp;gt;&lt;br /&gt;
    type             CDATA   #REQUIRED&lt;br /&gt;
    description      CDATA   &lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;type&lt;br /&gt;
:the returned value type.&lt;br /&gt;
;description&lt;br /&gt;
:the returned value description.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT throws&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST throws&amp;gt;&lt;br /&gt;
    type             CDATA   #REQUIRED&lt;br /&gt;
    description      CDATA   &lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;type&lt;br /&gt;
:the exception type.&lt;br /&gt;
;description&lt;br /&gt;
:describes when and why the exception can be thrown.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;!ELEMENT example&amp;gt;&lt;br /&gt;
 &amp;lt;!ATTLIST example&amp;gt;&lt;br /&gt;
    code             CDATA   #REQUIRED&lt;br /&gt;
    description      CDATA   &lt;br /&gt;
 &amp;gt;&lt;br /&gt;
&lt;br /&gt;
;code&lt;br /&gt;
:the code example.&lt;br /&gt;
;description&lt;br /&gt;
:comment.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
This is example of function definition with variable number of arguments.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;extension id=&amp;quot;defineClass&amp;quot; point=&amp;quot;ru.biosoft.plugins.javascript.function&amp;quot;&amp;gt; &lt;br /&gt;
    &amp;lt;function&lt;br /&gt;
      name=&amp;quot;defineClass&amp;quot; &lt;br /&gt;
      class=&amp;quot;ru.biosoft.plugins.javascript.Global&amp;quot; &lt;br /&gt;
      method=&amp;quot;defineClass&amp;quot; &lt;br /&gt;
      varargs=&amp;quot;true&amp;quot;&amp;gt; &lt;br /&gt;
        &amp;lt;doc description=&amp;quot;%defineClass.descr&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;argument name=&amp;quot;clazz&amp;quot; type=&amp;quot;String&amp;quot; obligatory=&amp;quot;true&amp;quot; description=&amp;quot;%defineClass.arg_1&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;returns type=&amp;quot;void&amp;quot;/&amp;gt;    &lt;br /&gt;
           &amp;lt;throws type=&amp;quot;IllegalAccessException&amp;quot;&lt;br /&gt;
             description=&amp;quot;if access is not available to a reflected class member&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;throws type=&amp;quot;InstantiationException&amp;quot; &lt;br /&gt;
             description=&amp;quot;if unable to instantiate the named class&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;throws type=&amp;quot;InvocationTargetException&amp;quot;&lt;br /&gt;
             description=&amp;quot;if an exception is thrown during execution of methods of the named class&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;throws type=&amp;quot;ClassDefinitionException&amp;quot;&lt;br /&gt;
             description=&amp;quot;if the format of the class causes this exception in ScriptableObject.defineClass&amp;quot;/&amp;gt;&lt;br /&gt;
           &amp;lt;throws type=&amp;quot;PropertyException&amp;quot;&lt;br /&gt;
             description=&amp;quot;if the format of the class causes this exception in ScriptableObject.defineClass&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;/doc&amp;gt;&lt;br /&gt;
    &amp;lt;/function&amp;gt;&lt;br /&gt;
 &amp;lt;/extension&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lan@dote.ru</name></author>	</entry>

	</feed>