Class Link.Launcher

java.lang.Object
org.apache.tools.ant.taskdefs.modules.Link.Launcher
Enclosing class:
Link

public class Link.Launcher extends Object
Child element representing a custom launcher command in a linked image. A launcher has a name, which is typically used as a file name for an executable file, a Java module name, and optionally a class within that module which can act as a standard Java main class.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new, unconfigured element.
    Launcher(String textSpec)
    Creates a new element from a jlink-compatible string specifier, which must take the form name=module or name=module/mainclass.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the attribute of this element which contains the main class to execute in this element's module, if that module doesn't define its main class.
    Returns the attribute of this element which contains the name of the Java module to execute.
    Returns this element's name attribute, typically used as the basis of an executable file name.
    void
    setMainClass(String className)
    Sets the attribute which contains the main class to execute in this element's module, if that module doesn't define its main class.
    void
    setModule(String module)
    Sets the attribute of this element which contains the name of a Java module to execute.
    void
    Sets this element's name attribute, which is typically used by the linker to create an executable file with a similar name.
    Returns this element's information in jlink launcher format: name=module or name=module/mainclass.
    void
    Verifies this element's state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Launcher

      public Launcher()
      Creates a new, unconfigured element.
    • Launcher

      public Launcher(String textSpec)
      Creates a new element from a jlink-compatible string specifier, which must take the form name=module or name=module/mainclass.
      Parameters:
      textSpec - name, module, and optional main class, as described above
      Throws:
      NullPointerException - if argument is null
      BuildException - if argument does not conform to above requirements
  • Method Details

    • getName

      public String getName()
      Returns this element's name attribute, typically used as the basis of an executable file name.
      Returns:
      this element's name
      See Also:
    • setName

      public void setName(String name)
      Sets this element's name attribute, which is typically used by the linker to create an executable file with a similar name. Thus, the name should contain only characters safe for file names.
      Parameters:
      name - name of launcher
    • getModule

      public String getModule()
      Returns the attribute of this element which contains the name of the Java module to execute.
      Returns:
      this element's module name
    • setModule

      public void setModule(String module)
      Sets the attribute of this element which contains the name of a Java module to execute.
      Parameters:
      module - name of module to execute
    • getMainClass

      public String getMainClass()
      Returns the attribute of this element which contains the main class to execute in this element's module, if that module doesn't define its main class.
      Returns:
      name of main class to execute
    • setMainClass

      public void setMainClass(String className)
      Sets the attribute which contains the main class to execute in this element's module, if that module doesn't define its main class.
      Parameters:
      className - name of class to execute
    • validate

      public void validate()
      Verifies this element's state.
      Throws:
      BuildException - if name or module is not set
    • toString

      public String toString()
      Returns this element's information in jlink launcher format: name=module or name=module/mainclass.
      Overrides:
      toString in class Object
      Returns:
      name, module and optional main class in jlink format