Class JSObject

java.lang.Object
de.inetsoftware.jwebassembly.web.JSObject
Direct Known Subclasses:
EventTarget, NodeList, Window

public class JSObject extends Object
The base type for all wrapped JavaScript objects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Object
    Native object from JavaScript.
    private static final String
    module name for JavaScript helper of the web
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Create a Java instance as wrapper of the JavaScript object.
  • Method Summary

    Modifier and Type
    Method
    Description
    static DOMString
    Get the dom string from a java string https://developer.mozilla.org/de/docs/Web/API/DOMString
    protected <T> T
    get(String propName)
    Get the value of a property of this object.
    private static <T> T
    get0(Object peer, DOMString propName)
    Native get a JavaScript property value by name.
    protected <T> T
    invoke(String methodName, Object param1)
    Invoke a JavaScript method with one non string parameter of this object.
    protected <T> T
    invoke(String methodName, String param1)
    Invoke a JavaScript method with one string parameter of this object.
    private static <T> T
    invoke0(Object peer, DOMString methodName, Object param1)
    Native invoke a JavaScript method with one parameter.
    protected void
    set(String propName, String value)
    Set the value of a property of this object.
    private static void
    set0(Object peer, DOMString propName, Object value)
    Native set a JavaScript property value by name.
    protected static <T> T
    win_get(String propName)
    Get a JavaScript property value by name from global variable window.
    private static <T> T
    win_get0(DOMString propName)
    Native get a JavaScript property value by name from global variable window.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • WEB

      private static final String WEB
      module name for JavaScript helper of the web
      See Also:
    • peer

      protected final Object peer
      Native object from JavaScript.
  • Constructor Details

    • JSObject

      protected JSObject(Object peer)
      Create a Java instance as wrapper of the JavaScript object.
      Parameters:
      peer - the native JavaScript object
  • Method Details

    • win_get0

      private static <T> T win_get0(DOMString propName)
      Native get a JavaScript property value by name from global variable window.
      Type Parameters:
      T - the return type
      Parameters:
      propName - the name of the property as DOMString
      Returns:
      the value of the property
    • win_get

      protected static <T> T win_get(@Nonnull String propName)
      Get a JavaScript property value by name from global variable window.
      Type Parameters:
      T - the return type
      Parameters:
      propName - the name of the property as DOMString
      Returns:
      the value of the property
    • get0

      private static <T> T get0(Object peer, DOMString propName)
      Native get a JavaScript property value by name.
      Type Parameters:
      T - the return type
      Parameters:
      peer - the JavaScript object
      propName - the name of the property as DOMString
      Returns:
      the value of the property
    • get

      protected <T> T get(@Nonnull String propName)
      Get the value of a property of this object.
      Type Parameters:
      T - the return type
      Parameters:
      propName - the name of the property
      Returns:
      the value of the property
    • set0

      private static void set0(Object peer, @Nonnull DOMString propName, Object value)
      Native set a JavaScript property value by name.
      Parameters:
      peer - the JavaScript object
      propName - the name of the property as DOMString
      value - the value of the property
    • set

      protected void set(@Nonnull String propName, String value)
      Set the value of a property of this object.
      Parameters:
      propName - the name of the property
      value - the value of the property
    • invoke0

      private static <T> T invoke0(Object peer, DOMString methodName, Object param1)
      Native invoke a JavaScript method with one parameter.
      Type Parameters:
      T - the return type
      Parameters:
      peer - the JavaScript object
      methodName - the method name
      param1 - the parameter
      Returns:
      the return value
    • invoke

      protected <T> T invoke(@Nonnull String methodName, String param1)
      Invoke a JavaScript method with one string parameter of this object.
      Type Parameters:
      T - the return type
      Parameters:
      methodName - the method name
      param1 - the parameter
      Returns:
      the return value
    • invoke

      protected <T> T invoke(@Nonnull String methodName, Object param1)
      Invoke a JavaScript method with one non string parameter of this object.
      Type Parameters:
      T - the return type
      Parameters:
      methodName - the method name
      param1 - the parameter
      Returns:
      the return value
    • domString

      public static DOMString domString(@Nonnull String str)
      Get the dom string from a java string https://developer.mozilla.org/de/docs/Web/API/DOMString
      Parameters:
      str - the Java string
      Returns:
      dom string