Class Link.Launcher

  • Enclosing class:
    Link

    public class Link.Launcher
    extends java.lang.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
      Launcher()
      Creates a new, unconfigured element.
      Launcher​(java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.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.
      java.lang.String getModule()
      Returns the attribute of this element which contains the name of the Java module to execute.
      java.lang.String getName()
      Returns this element's name attribute, typically used as the basis of an executable file name.
      void setMainClass​(java.lang.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​(java.lang.String module)
      Sets the attribute of this element which contains the name of a Java module to execute.
      void setName​(java.lang.String name)
      Sets this element's name attribute, which is typically used by the linker to create an executable file with a similar name.
      java.lang.String toString()
      Returns this element's information in jlink launcher format: name=module or name=module/mainclass.
      void validate()
      Verifies this element's state.
      • Methods inherited from class java.lang.Object

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

      • Launcher

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

        public Launcher​(java.lang.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:
        java.lang.NullPointerException - if argument is null
        BuildException - if argument does not conform to above requirements
    • Method Detail

      • getName

        public java.lang.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(String)
      • setName

        public void setName​(java.lang.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 java.lang.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​(java.lang.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 java.lang.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​(java.lang.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 java.lang.String toString()
        Returns this element's information in jlink launcher format: name=module or name=module/mainclass.
        Overrides:
        toString in class java.lang.Object
        Returns:
        name, module and optional main class in jlink format