public class Version extends java.lang.Object implements java.lang.Comparable<Version>
Version
represents the version part of an IPS package FMRI.
The version format is release[,build_release]-branch:publishtime, which is
decomposed into three DotSequences and the publish time. The text
representation of the publish time is in the ISO8601-compliant form "YYYYMMDDTHHMMSSZ",
referring to the UTC time associated with the version. The release and
branch DotSequences are interpreted normally, where v1 < v2 implies that
v2 is a later release or branch. The build_release DotSequence records
the system on which the package binaries were constructed.
Interpretation of the build_release by the client is that, in the case
b1 < b2, a b1 package can be run on either b1 or b2 systems, while a b2
package can only be run on a b2 system.Modifier and Type | Class and Description |
---|---|
static class |
Version.DotSequence
The
DotSequence class represents the x.y.z parts of a Version object. |
Constructor and Description |
---|
Version(java.lang.String s)
Create a
Version based on the given string representation. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Version v)
Compare two versions.
|
boolean |
equals(java.lang.Object v)
Compare two versions for equality.
|
Version.DotSequence |
getBranch()
Returns the branch part of the
Version . |
java.util.Date |
getPublishDate()
Returns the publish time part of the
Version . |
Version.DotSequence |
getRelease()
Returns the release part of the
Version . |
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isNull()
Tests whether this object is equal to the null or empty Version,
i.e., Version("")
|
boolean |
isSuccessor(Version v)
Determine if a version is a successor to this version.
|
boolean |
matches(Version v)
Determine if a version matches this version
A version v matches this version if it is all of the version information
that is specified matches the corresponding version information in this
version.
|
java.lang.String |
toString()
Returns a string representation for the
Version . |
public Version(java.lang.String s)
Version
based on the given string representation.s
- the string representation for the versionpublic boolean matches(Version v)
v
- the version to comparepublic boolean equals(java.lang.Object v)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(Version v)
compareTo
in interface java.lang.Comparable<Version>
v
- public boolean isSuccessor(Version v)
public java.lang.String toString()
Version
.toString
in class java.lang.Object
public boolean isNull()
public Version.DotSequence getRelease()
Version
.public Version.DotSequence getBranch()
Version
.public java.util.Date getPublishDate()
Version
.
If no publish time was provided when the object was created, the publish
time returned is a Date created with 0.