info.aduna.app
Class AppVersion

java.lang.Object
  extended by info.aduna.app.AppVersion

public class AppVersion
extends Object

A product version in Aduna's version format (i.e. major.minor-modifier). Where major stands for the major version number of the release, minor is the minor version number, and modifier is a modifier for the release, e.g. beta1 or RC1. Combined, this results in versions like 2.0 and 4.1-beta1.


Constructor Summary
AppVersion()
          Construct an uninitialized AppVersion.
AppVersion(int major, int minor)
          Creates a new version for the supplied combination of major and minor version numbers.
AppVersion(int major, int minor, String modifier)
          Creates a new version for the supplied combination of year, quarter and release modifier.
 
Method Summary
 boolean equals(Object other)
           
 int getMajor()
          Gets the version's year part.
 int getMinor()
          Gets the version's quarter part.
 String getModifier()
          Gets the version's release modifier part.
 int hashCode()
           
 boolean newerThan(AppVersion other)
          Checks if this version is newer than the specified version.
 boolean olderThan(AppVersion other)
          Checks if this version is older than the specified version.
static AppVersion parse(String versionString)
          Parses a version string into a Version object.
 void setMajor(int major)
           
 void setMinor(int minor)
           
 void setModifier(String modifier)
           
 String toString()
          Returns the string represention of this version.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppVersion

public AppVersion()
Construct an uninitialized AppVersion.


AppVersion

public AppVersion(int major,
                  int minor)
Creates a new version for the supplied combination of major and minor version numbers.


AppVersion

public AppVersion(int major,
                  int minor,
                  String modifier)
Creates a new version for the supplied combination of year, quarter and release modifier.

Method Detail

getMajor

public int getMajor()
Gets the version's year part.


setMajor

public void setMajor(int major)

getMinor

public int getMinor()
Gets the version's quarter part.


setMinor

public void setMinor(int minor)

getModifier

public String getModifier()
Gets the version's release modifier part.


setModifier

public void setModifier(String modifier)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

olderThan

public boolean olderThan(AppVersion other)
Checks if this version is older than the specified version. Note that this method returns false if only the modifier of the versions are different.

Parameters:
other - The version to compare to.
Returns:
true if the combination of year and quarter of this object is older than that of the other, false otherwise.

newerThan

public boolean newerThan(AppVersion other)
Checks if this version is newer than the specified version. Note that this method returns false if only the modifier of the versions are different.

Parameters:
other - The version to compare to.
Returns:
true if the combination of year and quarter of this object is newer than that of the other, false otherwise.

parse

public static AppVersion parse(String versionString)
Parses a version string into a Version object.

Parameters:
versionString - A version string, e.g. 2003.1 or 2004.1.RC2.
Returns:
The parsed Version.
Throws:
NumberFormatException - If versionString could not be parsed to a version.

toString

public String toString()
Returns the string represention of this version.

Overrides:
toString in class Object


Copyright © 1997-2008 Aduna. All Rights Reserved.