Serializable
, Comparable<Version>
public final class Version extends Object implements Comparable<Version>, 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(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(String v) |
Parses the given string as a version string.
|
String |
toString() |
Returns the normalized string representation of this version.
|
public static Version parse(String v)
v
- The string to parseVersion
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 Comparable<Version>
that
- The module version to comparepublic boolean equals(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.
public int hashCode()
The hash code is based upon the components of the version and
satisfies the general contract of the Object.hashCode
method.
Copyright © 2018 JBoss by Red Hat. All rights reserved.