java.io.Serializable
, java.lang.Comparable<Version>
public final class Version extends java.lang.Object implements java.lang.Comparable<Version>, java.io.Serializable
.
, -
, +
, and _
. The transition between letter and digit (or vice-versa) is
also considered to be an invisible separator.
Versions may be compared, sorted, used as hash keys, and iterated.
Modifier and Type | Class | Description |
---|---|---|
class |
Version.Iterator |
An iterator over the parts of a version.
|
Modifier and Type | Method | Description |
---|---|---|
int |
compareTo(Version that) |
Compares this module version to another module version.
|
boolean |
equals(java.lang.Object ob) |
Tests this module version for equality with the given object.
|
int |
hashCode() |
Computes a hash code for this module version.
|
Version.Iterator |
iterator() |
Construct a new iterator over the parts of this version string.
|
static Version |
parse(java.lang.String v) |
Parses the given string as a version string.
|
java.lang.String |
toString() |
Returns the normalized string representation of this version.
|
public static Version parse(java.lang.String v)
v
- The string to parseVersion
java.lang.IllegalArgumentException
- If v
is null
, an empty string, or cannot be
parsed as a version stringpublic Version.Iterator iterator()
public int compareTo(Version that)
compareTo
in interface java.lang.Comparable<Version>
that
- The module version to comparepublic boolean equals(java.lang.Object ob)
If the given object is not a Version
then this method
returns false
. Two module version are equal if their
corresponding components are equal.
This method satisfies the general contract of the Object.equals
method.
equals
in class java.lang.Object
ob
- the object to which this object is to be comparedtrue
if, and only if, the given object is a module
reference that is equal to this module referencepublic int hashCode()
The hash code is based upon the components of the version and
satisfies the general contract of the Object.hashCode
method.
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2022 JBoss by Red Hat. All rights reserved.