org.apache.avalon.framework
public final class Version extends Object implements Serializable
Component is made up of three
dot-separated fields:
"major.minor.micro"
The major, minor and micro fields are
integer numbers represented in decimal notation and have the
following meaning:
Version: CVS $Revision: 1.26 $ $Date: 2003/02/11 16:19:27 $
| Constructor Summary | |
|---|---|
| Version(int major, int minor, int micro)
Create a new instance of a Version object with the
specified version numbers.
| |
| Method Summary | |
|---|---|
| boolean | complies(Version other)
Check this Version against another for compliancy
(compatibility).
|
| boolean | equals(Version other)
Check this Version against another for equality.
|
| boolean | equals(Object other)
Indicates whether some other object is "equal to" this Version.
|
| int | getMajor()
Retrieve major component of version.
|
| int | getMicro()
Retrieve micro component of version.
|
| int | getMinor()
Retrieve minor component of version.
|
| static Version | getVersion(String version)
Parse a version out of a string.
|
| String | toString()
Overload toString to report version correctly.
|
Version object with the
specified version numbers.
Parameters: major This Version major number. minor This Version minor number. micro This Version micro number.
Version against another for compliancy
(compatibility).
If this Version is compatible with the specified one, then
true is returned, otherwise false. Be careful when using
this method since, in example, version 1.3.7 is compliant to version
1.3.6, while the opposite is not.
The following example displays the expected behaviour and results of version.
final Version v1 = new Version( 1, 3 , 6 ); final Version v2 = new Version( 1, 3 , 7 ); final Version v3 = new Version( 1, 4 , 0 ); final Version v4 = new Version( 2, 0 , 1 ); assert( v1.complies( v1 ) ); assert( ! v1.complies( v2 ) ); assert( v2.complies( v1 ) ); assert( ! v1.complies( v3 ) ); assert( v3.complies( v1 ) ); assert( ! v1.complies( v4 ) ); assert( ! v4.complies( v1 ) );
Parameters: other The other Version object to be compared with this
for compliancy (compatibility).
Returns: true if this Version is compatible with the specified one
Version against another for equality.
If this Version is compatible with the specified one, then
true is returned, otherwise false.
Parameters: other The other Version object to be compared with this
for equality.
Returns: true if this Version is compatible with the specified one
Since: 4.1
Version.
Returns true if the other object is an instance of Version
and has the same major, minor, and micro components.
Parameters: other an Object value
Returns: true if the other object is equal to this Version
Returns: the major component of version
Since: 4.1
Returns: the micro component of version.
Since: 4.1
Returns: the minor component of version
Since: 4.1
Parameters: version The input version string
Returns: the new Version object
Throws: NumberFormatException if an error occurs IllegalArgumentException if an error occurs
Since: 4.1
Returns: the dot seperated version string