ModuleVersion (Apache Ant API)

Package org.apache.tools.ant.types

## Class ModuleVersion

- java.lang.Object
- - org.apache.tools.ant.types.ModuleVersion

-     public class ModuleVersion
      extends java.lang.Object

  Element describing the parts of a Java module version. The version number is required; all other parts are optional.
  Since:
    1.10.6

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ModuleVersion()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getBuild()` | Returns this element's build version, if set.
    `java.lang.String` | `getNumber()` | Returns this element's version number.
    `java.lang.String` | `getPreRelease()` | Returns this element's pre-release version, if set.
    `void` | `setBuild​(java.lang.String build)` | Sets this element's build version.
    `void` | `setNumber​(java.lang.String number)` | Sets this element's required version number.
    `void` | `setPreRelease​(java.lang.String pre)` | Sets this element's pre-release version.
    `java.lang.String` | `toModuleVersionString()` | Snapshots this element's state and converts it to a string compliant with `ModuleDescriptor.Version`.
    `java.lang.String` | `toString()` | Returns a summary of this object's state, suitable for debugging.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ModuleVersion

          public ModuleVersion()

  - ### Method Detail

    - #### getNumber

          public java.lang.String getNumber()

      Returns this element's version number.
      Returns:
        version number

    - #### setNumber

          public void setNumber​(java.lang.String number)

      Sets this element's required version number. This cannot contain an ASCII hyphen (`-`) or plus (`+`), as those characters are used as delimiters in a complete module version string.
      Parameters:
        `number` - version number
      Throws:
        `java.lang.NullPointerException` - if argument is `null`
        `java.lang.IllegalArgumentException` - if argument contains `'-'` or `'+'`

    - #### getPreRelease

          public java.lang.String getPreRelease()

      Returns this element's pre-release version, if set.
      Returns:
        pre-release value, or `null`

    - #### setPreRelease

          public void setPreRelease​(java.lang.String pre)

      Sets this element's pre-release version. This can be any value which doesn't contain an ASCII plus (`+`).
      Parameters:
        `pre` - pre-release version, or `null`
      Throws:
        `java.lang.IllegalArgumentException` - if argument contains "`+`"

    - #### getBuild

          public java.lang.String getBuild()

      Returns this element's build version, if set.
      Returns:
        build value, or `null`

    - #### setBuild

          public void setBuild​(java.lang.String build)

      Sets this element's build version. This can be any value, including `null`.
      Parameters:
        `build` - build version, or `null`

    - #### toModuleVersionString

          public java.lang.String toModuleVersionString()

      Snapshots this element's state and converts it to a string compliant with `ModuleDescriptor.Version`.
      Returns:
        Java module version string built from this object's properties
      Throws:
        `java.lang.IllegalStateException` - if number is `null`

    - #### toString

          public java.lang.String toString()

      Returns a summary of this object's state, suitable for debugging.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        string form of this instance