All Downloads are FREE. Search and download functionalities are using the official Maven repository.

reference.language.bindings_methods.html Maven / Gradle / Ivy




    
    Errors
    
    

    
    

    
    

    
    
    
    

    


Binding global methods

Binding global methods is done as follows:

Notice the native keyword in the method definition. This denotes a native binding method.

The method body must then comprise exactly 1 binding statement per supported host language. The statement must be a single one (list of statements separated by ';' is not supported).

When a native method is executed, Prompto converts the parameter values from Prompto types to their equivalent native type. It then looks for the native statement matching the host language, and executes it. If the statement is an expression or function call returning a value, it converts that value from its native type to the corresponding Prompto type.

If a native method returns a value, the return type must be specified. This is because Python and JavaScript have no support for static typing, thus preventing Prompto from inferring the return type.

Binding methods with Java methods

Binding methods with Java methods is done by using the Java: keyword, followed by a Java statement, ending with a semicolon.

If the Java statement is a method call, that method must be static.

The method must be preceded by the fully qualified class name i.e. including full package, except for java.lang package.

Java: return prompto.internet.Html.encode(value);

If the Prompto method must return a value, the Java statement must start with the return keyword.

Binding methods with C# methods

Binding methods with C# methods is done by using the C#: keyword, followed by a C# statement, ending with a semicolon.

If the C# statement is a method call, that method must be static.

The method must be preceded by the fully qualified class name i.e. including namespace.

C#: return System.Net.WebUtility.HtmlEncode(value);

If the Prompto method must return a value, the C# statement must start with the return keyword.

Binding methods with Python 2 functions

Binding methods with Python 2 functions is done by using the Python2: keyword, followed by a Python 2 statement.

If the Python 2 statement refers to a method or variable which does not belong to the global namespace, the import module must be provided, as follows:

Python2: return escape(value) from module: cgi

If the Prompto method must return a value, the Python statement must start with the return keyword.

Binding methods with Python 3 functions

Binding methods with Python 3 functions is done by using the Python2: keyword, followed by a Python 3 statement.

If the Python 3 statement refers to a method or variable which does not belong to the global namespace, the import module must be provided, as follows:

Python2: return escape(value) from module: html

If the Prompto method must return a value, the Python statement must start with the return keyword.

Binding methods with JavaScript functions

Binding methods with JavaScript functions is done by using the JavaScript: keyword, followed by a JavaScript statement, ending with a semicolon.

If the JavaScript is a method or variable which does not belong to the global namespace, the import module must be provided, as follows:

JavaScript: return Encoder.htmlEncode(value); from module: prompto/internet/Html.js

If the Prompto method must return a value, the JavaScript statement must start with the return keyword.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy