org.jboss.classloading.spi.version
Class Version

java.lang.Object
  extended by org.jboss.classloading.spi.version.Version
All Implemented Interfaces:
Serializable, Comparable<Version>

public class Version
extends Object
implements Serializable, Comparable<Version>

Version.

Version:
$Revision: 1.1 $
Author:
Ales Justin, Adrian Brock
See Also:
Serialized Form

Field Summary
static Version DEFAULT_VERSION
          The default version
 
Constructor Summary
Version(int major, int minor, int micro)
          Create a new Version.
Version(int major, int minor, int micro, String qualifier)
          Create a new VersionImpl.
 
Method Summary
 int compareTo(Version version)
          Compare two Versions.
 boolean equals(Object object)
           
 int getMajor()
          Returns the major component of this version identifier.
 int getMicro()
          Returns the micro component of this version identifier.
 int getMinor()
          Returns the minor component of this version identifier.
 String getQualifier()
          Returns the qualifier component of this version identifier.
 int hashCode()
           
static Version parseVersion(String version)
          Parses a version identifier from the specified string.
 String toString()
           
protected  void validate()
          Validate arguments.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VERSION

public static final Version DEFAULT_VERSION
The default version

Constructor Detail

Version

public Version(int major,
               int minor,
               int micro)
Create a new Version.

Parameters:
major - the major part
minor - the minor part
micro - the micro part

Version

public Version(int major,
               int minor,
               int micro,
               String qualifier)
Create a new VersionImpl.

Parameters:
major - the major part
minor - the minor part
micro - the micro part
qualifier - the qualifier
Method Detail

validate

protected void validate()
Validate arguments.


parseVersion

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. Leading and trailing whitespace will be ignored.
Returns:
A Version object representing the version identifier. If version is null or the empty string then emptyVersion will be returned.
Throws:
IllegalArgumentException - If version is improperly formatted.

getMajor

public int getMajor()
Returns the major component of this version identifier.

Returns:
The major component.

getMinor

public int getMinor()
Returns the minor component of this version identifier.

Returns:
The minor component.

getMicro

public int getMicro()
Returns the micro component of this version identifier.

Returns:
The micro component.

getQualifier

public String getQualifier()
Returns the qualifier component of this version identifier.

Returns:
The qualifier component.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

compareTo

public int compareTo(Version version)
Compare two Versions.

Specified by:
compareTo in interface Comparable<Version>
Parameters:
version - the other version
Returns:
compare result


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.