Interface JavaScript

All Known Implementing Classes:
Session

public interface JavaScript
  • Method Summary

    Modifier and Type Method Description
    default void callFunction​(java.lang.String name)
    Calls JavaScript function.
    default <T> T callFunction​(java.lang.String name, java.lang.Class<T> returnType)  
    default <T> T callFunction​(java.lang.String name, java.lang.Class<T> returnType, java.lang.Object... arguments)
    Calls JavaScript function.
    default java.lang.Object evaluate​(java.lang.String expression)
    Evaluates JavaScript expression in global scope.
    Session getThis()  
    default <T> T getVariable​(java.lang.String name, java.lang.Class<T> returnType)
    Gets JavaScript variable.
    default void setVariable​(java.lang.String name, java.lang.Object newValue)
    Sets JavaScript variable.
  • Method Details

    • evaluate

      default java.lang.Object evaluate​(java.lang.String expression)
      Evaluates JavaScript expression in global scope.
      Parameters:
      expression - JavaScript expression
      Returns:
      execution result
    • callFunction

      default void callFunction​(java.lang.String name)
      Calls JavaScript function.

      Function must be declared at the global (window object) scope. You can use dot notation for function name.

      Parameters:
      name - function name
    • callFunction

      default <T> T callFunction​(java.lang.String name, java.lang.Class<T> returnType)
    • callFunction

      default <T> T callFunction​(java.lang.String name, java.lang.Class<T> returnType, java.lang.Object... arguments)
      Calls JavaScript function.

      Function must be declared at the global (window object) scope. You can use dot notation for function name.

      Parameters:
      name - function name
      returnType - return type of function
      arguments - function arguments
      Returns:
      function result
    • getVariable

      default <T> T getVariable​(java.lang.String name, java.lang.Class<T> returnType)
      Gets JavaScript variable.

      Variable must be declared at the global (window object) scope. You can use dot notation for variable name.

      Parameters:
      name - variable name
      returnType - variable type
      Returns:
      variable value
    • setVariable

      default void setVariable​(java.lang.String name, java.lang.Object newValue)
      Sets JavaScript variable.

      Variable must be declared at the global (window object) scope. You can use dot notation for variable name.

      Parameters:
      name - variable name
      newValue - value
    • getThis

      Session getThis()