Package org.jboss.modules
Class Version
java.lang.Object
org.jboss.modules.Version
- All Implemented Interfaces:
Serializable,Comparable<Version>
A version for a module. Versions are series of letters and digits, optionally divided by separator characters, which
include
., -, +, 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.
- Author:
- David M. Lloyd
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionintCompares this module version to another module version.booleanTests this module version for equality with the given object.inthashCode()Computes a hash code for this module version.iterator()Construct a new iterator over the parts of this version string.static VersionParses the given string as a version string.toString()Returns the normalized string representation of this version.
-
Method Details
-
parse
Parses the given string as a version string.- Parameters:
v- The string to parse- Returns:
- The resulting
Version - Throws:
IllegalArgumentException- Ifvisnull, an empty string, or cannot be parsed as a version string
-
iterator
Construct a new iterator over the parts of this version string.- Returns:
- the iterator
-
compareTo
Compares this module version to another module version. Module versions are compared as described in the class description.- Specified by:
compareToin interfaceComparable<Version>- Parameters:
that- The module version to compare- Returns:
- A negative integer, zero, or a positive integer as this module version is less than, equal to, or greater than the given module version
-
equals
Tests this module version for equality with the given object.If the given object is not a
Versionthen this method returnsfalse. Two module version are equal if their corresponding components are equal.This method satisfies the general contract of the
Object.equalsmethod. -
hashCode
public int hashCode()Computes a hash code for this module version.The hash code is based upon the components of the version and satisfies the general contract of the
Object.hashCodemethod. -
toString
Returns the normalized string representation of this version.
-