Package org.apache.tools.ant.types

# Class ModuleVersion

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

public class ModuleVersion extends 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

Modifier and Type
Method
Description
`String`
`getBuild()`
Returns this element's build version, if set.
`String`
`getNumber()`
Returns this element's version number.
`String`
`getPreRelease()`
Returns this element's pre-release version, if set.
`void`
`setBuild(String build)`
Sets this element's build version.
`void`
`setNumber(String number)`
Sets this element's required version number.
`void`
`setPreRelease(String pre)`
Sets this element's pre-release version.
`String`
`toModuleVersionString()`
Snapshots this element's state and converts it to a string compliant with `ModuleDescriptor.Version`.
`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 Details

### ModuleVersion

public ModuleVersion()

## Method Details

### getNumber

public String getNumber()
Returns this element's version number.

Returns:
  version number

### setNumber

public void setNumber(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:
  `NullPointerException` - if argument is `null`
  `IllegalArgumentException` - if argument contains `'-'` or `'+'`

### getPreRelease

public String getPreRelease()
Returns this element's pre-release version, if set.

Returns:
  pre-release value, or `null`

### setPreRelease

public void setPreRelease(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:
  `IllegalArgumentException` - if argument contains "`+`"

### getBuild

public String getBuild()
Returns this element's build version, if set.

Returns:
  build value, or `null`

### setBuild

public void setBuild(String build)
Sets this element's build version. This can be any value, including `null`.

Parameters:
  `build` - build version, or `null`

### toModuleVersionString

public 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:
  `IllegalStateException` - if number is `null`

### toString

public String toString()
Returns a summary of this object's state, suitable for debugging.

Overrides:
  `toString` in class `Object`
Returns:
  string form of this instance