Interface JavaObjectElement

All Superinterfaces:
DomQueryable, Element, EventTarget, Node

public interface JavaObjectElement extends Element
The Java Object element in the header allows for java classes to be triggered from the DOM by specifying their class name.

Activation

When the Attributes.CLASS_NAME attribute is set, a lookup is made via Class.forName(String, boolean, ClassLoader) to find the class. The class will be loaded if not already loaded, and the Delphi plugin's class loader is used.

If found, then a public static void onDomInitialize(Document) method in the class is called. If the method cannot be found, then a public constructor with a single Document parameter will be called. If that doesn't exist, activation fails.

  • Field Details

  • Method Details

    • canHaveChildren

      @Contract("-> false") boolean canHaveChildren()
      Java objects elements cannot have any child nodes
      Specified by:
      canHaveChildren in interface Element
      Returns:
      false
    • getClassName

      @Nullable @Nullable String getClassName()
      Get the name of the linked class.

      If the class name is set, and the class it was linked to was found, then it can be accessed with getJavaClass().

      Shortcut for accessing the Attributes.CLASS_NAME attribute.

      Specified by:
      getClassName in interface Element
      Returns:
      Java Class name
    • getJavaClass

      @Nullable @Nullable Class<?> getJavaClass()
      Get the class named by getClassName().

      If getClassName() is not set, or if it doesn't name an existing class, then this method will return null.

      Returns:
      Java class
    • wasEntrypointCalled

      boolean wasEntrypointCalled()
      Get whether the getJavaClass()'s entry point was called. If this method returns false, then it means the entrypoint couldn't be found or threw an error when called.
      Returns:
      true, if the class entry point was called successfully, false otherwise.
    • setClassName

      void setClassName(String className)
      Set the name of the linked class.

      Shortcut for changing the Attributes.CLASS_NAME attribute.

      Specified by:
      setClassName in interface Element
      Parameters:
      className - New class name