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.

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

    • getClassName

      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

      Class<?> getJavaClass()
      Get the class named by getClassName().
      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