public class OmniVersion extends BasicVersion
The Generic Omni Version is composed of a vector of Comparable objects and a pad value. The pad
might be null. The vector can contain integers, strings, VersionVector
instances, or one of the special objects MAX_VALUE,
MAXS_VALUE, or MIN_VALUE.
When two versions are compared, they are always considered padded to infinity by their
pad value or by MIN_VALUE in case the pad value is
null. The comparison is type sensitive so that:
MAX_VALUE > Integer > VersionVector > MAXS_VALUE > String > MIN_VALUE
emptyVersion, MAX_VERSION, RAW_PREFIX| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version v) |
static Version |
createMaxVersion() |
static Version |
createMinVersion() |
boolean |
equals(java.lang.Object o) |
IVersionFormat |
getFormat()
Returns the optional format.
|
int |
getMajor()
Returns the OSGi major component of this version identifier.
|
int |
getMicro()
Returns the OSGi micro component of this version identifier.
|
int |
getMinor()
Returns the OSGi minor component of this version identifier.
|
java.lang.String |
getOriginal()
Returns the
original part of the string for this version
or null if no such part was provided when the version was
created. |
java.lang.Comparable<?> |
getPad()
Returns the pad value used when comparing this versions to
versions that has a larger number of segments
|
java.lang.String |
getQualifier()
Returns the OSGi qualifier component of this version identifier.
|
java.lang.Comparable<?> |
getSegment(int index)
An element from the raw vector representation of this version.
|
int |
getSegmentCount()
Returns the number of elements in the raw vector representation of this version.
|
int |
hashCode() |
boolean |
isOSGiCompatible()
Checks if this version is in compliance with the OSGi version spec.
|
void |
originalToString(java.lang.StringBuffer sb,
boolean rangeSafe)
Appends the original for this version onto the
sb StringBuffer
if present. |
void |
rawToString(java.lang.StringBuffer sb,
boolean rangeSafe)
Appends the raw format for this version onto the
sb StringBuffer. |
void |
toString(java.lang.StringBuffer sb)
Appends the string representation of this version onto the
sb StringBuffer. |
compile, create, createOSGi, createOSGi, parseVersion, toStringpublic static Version createMinVersion()
public static Version createMaxVersion()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic IVersionFormat getFormat()
Versionpublic int getMajor()
BasicVersiongetMajor in class BasicVersionVersion.isOSGiCompatible()public int getMicro()
BasicVersiongetMicro in class BasicVersionVersion.isOSGiCompatible()public int getMinor()
BasicVersiongetMinor in class BasicVersionVersion.isOSGiCompatible()public java.lang.String getOriginal()
Versionoriginal part of the string for this version
or null if no such part was provided when the version was
created. An OSGi type version will always return the OSGi string representation.getOriginal in class Versionoriginal part of the version string or
null if that part was missing.public java.lang.String getQualifier()
BasicVersiongetQualifier in class BasicVersionnull if not set.Version.isOSGiCompatible()public int hashCode()
hashCode in class java.lang.Objectpublic boolean isOSGiCompatible()
isOSGiCompatible in class Versionpublic void originalToString(java.lang.StringBuffer sb,
boolean rangeSafe)
sb StringBuffer
if present.originalToString in class BasicVersionsb - The buffer that will receive the raw string formatrangeSafe - Set to true if range delimiters should be escapedpublic void rawToString(java.lang.StringBuffer sb,
boolean rangeSafe)
sb StringBuffer.rawToString in class BasicVersionsb - The buffer that will receive the raw string formatrangeSafe - Set to true if range delimiters should be escapedpublic void toString(java.lang.StringBuffer sb)
sb StringBuffer.public java.lang.Comparable<?> getPad()
Versionpublic java.lang.Comparable<?> getSegment(int index)
VersiongetSegment in class Versionindex - The zero based index of the desired elementpublic int getSegmentCount()
VersiongetSegmentCount in class Versionpublic int compareTo(Version v)