org.identityconnectors.common
Class Version

java.lang.Object
  extended by org.identityconnectors.common.Version
All Implemented Interfaces:
Comparable<Version>

public final class Version
extends Object
implements Comparable<Version>

Encapsulates a version number. A version number is composed of up to four components: major, minor, micro and specification number.

Since:
1.1

Method Summary
 int compareTo(Version that)
           
static Version create(Integer... components)
          Creates a new version from components.
 boolean equals(Object o)
           
 Integer getMajor()
          Returns this version number's major component.
 Integer getMicro()
          Returns this version number's minor component.
 Integer getMinor()
          Returns this version number's minor component.
 Integer getRevision()
          Returns this version number's minor component.
 String getVersion()
          Returns this version as a string.
 int hashCode()
           
static Version parse(String version)
          Parses the passed version string.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

parse

public static Version parse(String version)
Parses the passed version string. The string can contain up to four numeric component separated by a dot, followed by an alphanumberic qualifier prepended by a dash. For example, the following are valid versions:

Parameters:
version - the version string.

create

public static Version create(Integer... components)
Creates a new version from components.

Parameters:
components - the components

getMajor

public Integer getMajor()
Returns this version number's major component.

Returns:
the major component; never null.

getMinor

public Integer getMinor()
Returns this version number's minor component.

Returns:
the minor component or null if this version number doesn't have a minor component.

getMicro

public Integer getMicro()
Returns this version number's minor component.

Returns:
the minor component or null if this version number doesn't have a minor component.

getRevision

public Integer getRevision()
Returns this version number's minor component.

Returns:
the minor component or null if this version number doesn't have a revision component.

getVersion

public String getVersion()
Returns this version as a string.

Returns:
this version as a string.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

compareTo

public int compareTo(Version that)
Specified by:
compareTo in interface Comparable<Version>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.