| java.lang.Object org.isqlviewer.util.Version
Version | public class Version implements Comparable<Version>,Serializable(Code) | | Version identifier for software bundles and packages.
This Version class supports four four components.
- Major version. A non-negative integer.
- Minor version. A non-negative integer.
- Patch version. A non-negative integer.
- Qualifier. A text string. See
Version(String) for the format of the qualifier string.
All Version object instances are immutable.
author: Mark A. Kobold <mkobold at isqlviewer dot com> version: 1.0 |
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. |
Method Summary | |
public int | compareTo(Version version) Compares this instance to another version.
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 all version components (major, minor, micro, and
qualifier) are equal.
Parameters: object - The Version object to be compared. | public boolean | equals(Object object) Compares this instance to another object.
A version is considered to be equal to another version if the version components (major, minor, micro,
qualifier) are equal.
Parameters: object - to test for equality. | public static Version | forString(String version) Parses a version identifier from the specified string.
Standard format for a version string.
VERSION ::= MAJOR [SEPERATOR MINOR [SEPERATOR PATCH [SEPERATOR QUALIFIER] ] ]
MAJOR ::= (DIGIT)+
MINOR ::= (DIGIT)+
PATCH ::= (DIGIT)+
QUALIFIER ::= (ALPHA|DIGIT|'_'|'-')+
SEPERATOR ::= '.'
DIGIT ::= {0..9}
ALPHA ::= {a..zA..Z}
Parameters: version - String representation of the version identifier. | public int | getMajor() Returns the major component of this version identifier. | public int | getMinor() Returns the minor component of this version identifier. | public int | getPatch() Returns the patch 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 String | toString() Returns the string representation of this version identifier. |
EMPTY_VERSION | final public static Version EMPTY_VERSION(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 are negative. |
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. If null is specified, then thequalifier will be set to the empty string. throws: IllegalArgumentException - If the numerical components are negative or the qualifier string is invalid. |
compareTo | public int compareTo(Version version)(Code) | | Compares this instance to another version.
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 all version components (major, minor, micro, and
qualifier) are equal.
Parameters: object - The Version object to be compared. Comparsion value defined by the comparable interface. |
equals | public boolean equals(Object object)(Code) | | Compares this instance to another object.
A version is considered to be equal to another version if the version components (major, minor, micro,
qualifier) are equal.
Parameters: object - to test for equality. true if object is a Version and is equal to this instance. Otherwise false. |
forString | public static Version forString(String version)(Code) | | Parses a version identifier from the specified string.
Standard format for a version string.
VERSION ::= MAJOR [SEPERATOR MINOR [SEPERATOR PATCH [SEPERATOR QUALIFIER] ] ]
MAJOR ::= (DIGIT)+
MINOR ::= (DIGIT)+
PATCH ::= (DIGIT)+
QUALIFIER ::= (ALPHA|DIGIT|'_'|'-')+
SEPERATOR ::= '.'
DIGIT ::= {0..9}
ALPHA ::= {a..zA..Z}
Parameters: version - String representation of the version identifier. new Version instance with the respective components from the version text. throws: IllegalArgumentException - If version text is not properly formatted. |
getMajor | public int getMajor()(Code) | | Returns the major component of this version identifier.
The major component. |
getMinor | public int getMinor()(Code) | | Returns the minor component of this version identifier.
The minor component. |
getPatch | public int getPatch()(Code) | | Returns the patch component of this version identifier.
The patch 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. |
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. |
|
|