com.ibm.are.common
Class Version

java.lang.Object
  extended by com.ibm.are.common.Version
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable

public class Version
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable

The Version class is the class that is used throughout the Application Runtime Expert to represent the version of various resources. This class is used to represent the version of the ARE Core, individual plugins, a deployment template, and other resources.

Version:
1.0
Author:
IBM

Field Summary
static java.lang.String COPYRIGHT
          Copyright for class bytecode
 
Constructor Summary
Version(int major)
          Constructs a Version object with the major version set to the input value.
Version(int major, int minor)
          Constructs a Version object with the major and minor versions set to the input values.
Version(int major, int minor, int revision)
          Constructs a Version object with the major, minor, and revision versions set to the input values.
Version(Version versionToCopy)
          Copy constructor.
 
Method Summary
protected  java.lang.Object clone()
          Creates and returns a clone of the Version object
 int compareTo(java.lang.Object obj)
          Compares two Version objects to see if they are equal.
 boolean equals(java.lang.Object obj)
          Comparison method that determines if two Version objects represent the exact same version.
 int getMajor()
          Retrieves the major version number
 int getMinor()
          Retrieves the minor version number
 int getRevision()
          Retrieves the revision version number
 boolean isEqualOrNewerThan(Version version)
          Check whether this version is newer than or equal to the input version object.
static Version parse(java.lang.String versionToParse)
          Parses the input String, pulling out the major, minor (if present), and revision (if present) levels.
 void setMajor(int major)
          Sets the major version number to the specified value
 void setMinor(int minor)
          Sets the minor version number to the specified value
 void setRevision(int revision)
          Sets the revision version number to the specified value
 java.lang.String toString()
          Builds and returns a String representation of the Version object
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Copyright for class bytecode

See Also:
Constant Field Values
Constructor Detail

Version

public Version(Version versionToCopy)
Copy constructor. This constructor returns a new Version object that has the exact same major, minor, and revision values as the input Version object.

Parameters:
versionToCopy - The Version to copy.

Version

public Version(int major)
Constructs a Version object with the major version set to the input value.

Parameters:
major - The major version to assign to the new object.

Version

public Version(int major,
               int minor)
Constructs a Version object with the major and minor versions set to the input values.

Parameters:
major - The major version to assign to the new object.
minor - The minor version to assign to the new object.

Version

public Version(int major,
               int minor,
               int revision)
Constructs a Version object with the major, minor, and revision versions set to the input values.

Parameters:
major - The major version to assign to the new object.
minor - The minor version to assign to the new object.
revision - The revision version to assign to the new object.
Method Detail

parse

public static Version parse(java.lang.String versionToParse)
Parses the input String, pulling out the major, minor (if present), and revision (if present) levels.

Parameters:
versionToParse - The version String to parse
Returns:
A Version object that represents the input version String
Throws:
java.lang.IllegalArgumentException - If the input String is not in a valid version String format

getMajor

public int getMajor()
Retrieves the major version number

Returns:
The major version number

setMajor

public void setMajor(int major)
Sets the major version number to the specified value

Parameters:
major - The value to set the major version number to

getMinor

public int getMinor()
Retrieves the minor version number

Returns:
The minor version number

setMinor

public void setMinor(int minor)
Sets the minor version number to the specified value

Parameters:
minor - The value to set the minor version number to

getRevision

public int getRevision()
Retrieves the revision version number

Returns:
The revision version number

setRevision

public void setRevision(int revision)
Sets the revision version number to the specified value

Parameters:
revision - The value to set the revision version number to

toString

public java.lang.String toString()
Builds and returns a String representation of the Version object

Overrides:
toString in class java.lang.Object
Returns:
A String representation of the Version object

equals

public boolean equals(java.lang.Object obj)
Comparison method that determines if two Version objects represent the exact same version.

Overrides:
equals in class java.lang.Object
Returns:
true if the two versions are the same, false if they are different

compareTo

public int compareTo(java.lang.Object obj)
Compares two Version objects to see if they are equal.

Specified by:
compareTo in interface java.lang.Comparable
Returns:
-1 if the Version object is less than the input object

0 if the two objects represent the exact same version

1 if the Version object is greater than the input object

Throws:
GenericAreException - If the input object is not an instance of the Version class.

isEqualOrNewerThan

public boolean isEqualOrNewerThan(Version version)
Check whether this version is newer than or equal to the input version object.

Parameters:
version - the object to compare to
Returns:
true if this object's version is equal or newer than the parameter, false if it is not

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Creates and returns a clone of the Version object

Overrides:
clone in class java.lang.Object
Returns:
A clone of the Version object
Throws:
java.lang.CloneNotSupportedException