| java.lang.Object org.eclipse.pde.internal.build.tasks.Version
Version | public class Version implements Comparable(Code) | | Version identifier for bundles and packages.
Version identifiers have four components.
- Major version. A non-negative integer.
- Minor version. A non-negative integer.
- Micro version. A non-negative integer.
- Qualifier. A text string. See
Version(String) for the
format of the qualifier string.
Version objects are immutable.
version: $Revision: 1.1 $ since: 1.3 |
Constructor Summary | |
public | Version(int major, int minor, int micro) Creates a version identifier from the specified numerical components. | public | Version(int major, int minor, int micro, String qualifier) Creates a version identifier from the specifed components.
Parameters: major - Major component of the version identifier. Parameters: minor - Minor component of the version identifier. Parameters: micro - Micro component of the version identifier. Parameters: qualifier - Qualifier component of the version identifier. | public | Version(String version) Created a version identifier from the specified string. |
Method Summary | |
public int | 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 ).
Parameters: object - The Version object to be compared. | public boolean | 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 ).
Parameters: object - The Version object to be compared. | public int | getMajor() Returns the major component of this version identifier. | public int | getMicro() Returns the micro component of this version identifier. | public int | getMinor() Returns the minor component of this version identifier. | public String | getQualifier() Returns the qualifier component of this version identifier. | public int | hashCode() Returns a hash code value for the object. | public static Version | parseVersion(String version) Parses a version identifier from the specified string.
See Version(String) for the format of the version string.
Parameters: version - String representation of the version identifier. | public String | toString() Returns the string representation of this version identifier. |
emptyVersion | final public static Version emptyVersion(Code) | | The empty version "0.0.0". Equivalent to calling
new Version(0,0,0) .
|
Version | public Version(int major, int minor, int micro)(Code) | | Creates a version identifier from the specified numerical components.
The qualifier is set to the empty string.
Parameters: major - Major component of the version identifier. Parameters: minor - Minor component of the version identifier. Parameters: micro - Micro component of the version identifier. throws: IllegalArgumentException - If the numerical components arenegative. |
Version | public Version(int major, int minor, int micro, String qualifier)(Code) | | Creates a version identifier from the specifed components.
Parameters: major - Major component of the version identifier. Parameters: minor - Minor component of the version identifier. Parameters: micro - Micro component of the version identifier. Parameters: qualifier - Qualifier component of the version identifier. Ifnull is specified, then the qualifier will be setto the empty string. throws: IllegalArgumentException - If the numerical components are negativeor the qualifier string is invalid. |
Version | public Version(String version)(Code) | | 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.
Parameters: version - String representation of the version identifier. throws: IllegalArgumentException - If version is improperlyformatted. |
compareTo | public int compareTo(Object object)(Code) | | 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 ).
Parameters: object - The Version object to be compared. A negative integer, zero, or a positive integer if this object isless than, equal to, or greater than the specifiedVersion object. throws: ClassCastException - If the specified object is not aVersion . |
equals | public boolean equals(Object object)(Code) | | 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 ).
Parameters: object - The Version object to be compared. true if object is aVersion and is equal to this object;false otherwise. |
getMajor | public int getMajor()(Code) | | Returns the major component of this version identifier.
The major component. |
getMicro | public int getMicro()(Code) | | Returns the micro component of this version identifier.
The micro component. |
getMinor | public int getMinor()(Code) | | Returns the minor component of this version identifier.
The minor component. |
getQualifier | public String getQualifier()(Code) | | Returns the qualifier component of this version identifier.
The qualifier component. |
hashCode | public int hashCode()(Code) | | Returns a hash code value for the object.
An integer which is a hash code value for this object. |
parseVersion | public static Version parseVersion(String version)(Code) | | Parses a version identifier from the specified string.
See Version(String) for the format of the version string.
Parameters: version - String representation of the version identifier. Leadingand trailing whitespace will be ignored. A Version object representing the versionidentifier. If version is null orthe empty string then emptyVersion will bereturned. throws: IllegalArgumentException - If version is improperlyformatted. |
toString | public String toString()(Code) | | 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.
The string representation of this version identifier. |
|
|