Version identifiers have four components.
Version(String)
for the format of the qualifier string.
Version
objects are immutable.
Definition at line 44 of file Version.java.
Public Member Functions | |
Version (int major, int minor, int micro) | |
Creates a version identifier from the specified numerical components. | |
Version (int major, int minor, int micro, String qualifier) | |
Creates a version identifier from the specifed components. | |
Version (String version) | |
Created a version identifier from the specified string. | |
int | getMajor () |
Returns the major component of this version identifier. | |
int | getMinor () |
Returns the minor component of this version identifier. | |
int | getMicro () |
Returns the micro component of this version identifier. | |
String | getQualifier () |
Returns the qualifier component of this version identifier. | |
String | toString () |
Returns the string representation of this version identifier. | |
int | hashCode () |
Returns a hash code value for the object. | |
boolean | equals (Object object) |
Compares this Version object to another object. | |
int | compareTo (Object object) |
Compares this Version object to another object. | |
Static Public Member Functions | |
static Version | parseVersion (String version) |
Parses a version identifier from the specified string. | |
Static Public Attributes | |
static final Version | emptyVersion = new Version(0, 0, 0) |
The empty version "0.0.0". |
org.osgi.framework.Version.Version | ( | int | major, | |
int | minor, | |||
int | micro | |||
) |
Creates a version identifier from the specified numerical components.
The qualifier is set to the empty string.
major | Major component of the version identifier. | |
minor | Minor component of the version identifier. | |
micro | Micro component of the version identifier. |
IllegalArgumentException | If the numerical components are negative. |
Definition at line 69 of file Version.java.
Referenced by org.osgi.framework.Version.parseVersion().
org.osgi.framework.Version.Version | ( | int | major, | |
int | minor, | |||
int | micro, | |||
String | qualifier | |||
) |
Creates a version identifier from the specifed components.
major | Major component of the version identifier. | |
minor | Minor component of the version identifier. | |
micro | Micro component of the version identifier. | |
qualifier | Qualifier component of the version identifier. If null is specified, then the qualifier will be set to the empty string. |
IllegalArgumentException | If the numerical components are negative or the qualifier string is invalid. |
Definition at line 85 of file Version.java.
org.osgi.framework.Version.Version | ( | String | version | ) |
Created a version identifier from the specified string.
Here is the grammar for version strings.
version ::= major('.'minor('.'micro('.'qualifier)?)?)? major ::= digit+ minor ::= digit+ micro ::= digit+ qualifier ::= (alpha|digit|'_'|'-')+ digit ::= [0..9] alpha ::= [a..zA..Z]
There must be no whitespace in version.
version | String representation of the version identifier. |
IllegalArgumentException | If version is improperly formatted. |
Definition at line 119 of file Version.java.
static Version org.osgi.framework.Version.parseVersion | ( | String | version | ) | [static] |
Parses a version identifier from the specified string.
See Version(String)
for the format of the version string.
version | String representation of the version identifier. Leading and trailing whitespace will be ignored. |
Version
object representing the version identifier. If version
is null
or the empty string then emptyVersion
will be returned. IllegalArgumentException | If version is improperly formatted. |
Definition at line 198 of file Version.java.
References org.osgi.framework.Version.emptyVersion, and org.osgi.framework.Version.Version().
int org.osgi.framework.Version.getMajor | ( | ) |
Returns the major component of this version identifier.
Definition at line 216 of file Version.java.
int org.osgi.framework.Version.getMinor | ( | ) |
Returns the minor component of this version identifier.
Definition at line 225 of file Version.java.
int org.osgi.framework.Version.getMicro | ( | ) |
Returns the micro component of this version identifier.
Definition at line 234 of file Version.java.
String org.osgi.framework.Version.getQualifier | ( | ) |
Returns the qualifier component of this version identifier.
Definition at line 243 of file Version.java.
String org.osgi.framework.Version.toString | ( | ) |
Returns the string representation of this version identifier.
The format of the version string will be major.minor.micro
if qualifier is the empty string or major.minor.micro.qualifier
otherwise.
Definition at line 257 of file Version.java.
Referenced by org.knopflerfish.framework.ExportedPackageImpl.getSpecificationVersion(), org.knopflerfish.framework.ImportPkg.ImportPkg(), and org.knopflerfish.framework.VersionRange.toString().
int org.osgi.framework.Version.hashCode | ( | ) |
Returns a hash code value for the object.
Definition at line 272 of file Version.java.
Referenced by org.knopflerfish.framework.VersionRange.hashCode().
boolean org.osgi.framework.Version.equals | ( | Object | object | ) |
Compares this Version
object to another object.
A version is considered to be equal to another version if the major, minor and micro components are equal and the qualifier component is equal (using String.equals
).
object | The Version object to be compared. |
true
if object
is a Version
and is equal to this object; false
otherwise. Definition at line 290 of file Version.java.
References org.osgi.framework.Version.major, org.osgi.framework.Version.micro, org.osgi.framework.Version.minor, and org.osgi.framework.Version.qualifier.
Referenced by org.knopflerfish.framework.VersionRange.equals(), org.knopflerfish.framework.ExportPkg.ExportPkg(), and org.knopflerfish.framework.Bundles.getBundle().
int org.osgi.framework.Version.compareTo | ( | Object | object | ) |
Compares this Version
object to another object.
A version is considered to be less than another version if its major component is less than the other version's major component, or the major components are equal and its minor component is less than the other version's minor component, or the major and minor components are equal and its micro component is less than the other version's micro component, or the major, minor and micro components are equal and it's qualifier component is less than the other version's qualifier component (using String.compareTo
).
A version is considered to be equal to another version if the major, minor and micro components are equal and the qualifier component is equal (using String.compareTo
).
object | The Version object to be compared. |
Version
object. ClassCastException | If the specified object is not a Version . |
Definition at line 329 of file Version.java.
References org.osgi.framework.Version.major, org.osgi.framework.Version.micro, org.osgi.framework.Version.minor, and org.osgi.framework.Version.qualifier.
Referenced by org.knopflerfish.framework.VersionRange.compareTo(), org.knopflerfish.framework.Bundles.getBundles(), and org.knopflerfish.framework.VersionRange.withinRange().
final Version org.osgi.framework.Version.emptyVersion = new Version(0, 0, 0) [static] |
The empty version "0.0.0".
Equivalent to calling new Version(0,0,0)
.
Definition at line 55 of file Version.java.
Referenced by org.knopflerfish.framework.ImportPkg.ImportPkg(), org.osgi.framework.Version.parseVersion(), org.knopflerfish.framework.ExportPkg.pkgString(), and org.knopflerfish.framework.VersionRange.VersionRange().