ice.util
Class JavaVersion

java.lang.Object
  extended byice.util.AbstractVersion
      extended byice.util.JavaVersion
All Implemented Interfaces:
Comparable

public class JavaVersion
extends AbstractVersion

This class provides some common operations relating to Java versioning for the browser environment. Simple checks that the current VM is at least v1.2 can be done with: JavaVersion.isV12orGreater()

To compare two Version objects, use the Comparator classes provided in ice.util

Since:
5_5
See Also:
FullVersionComparator, MajorMinorVersionComparator

Field Summary
static int BUILD_PART_ONE
          Portion of build spec before the underscore
static int BUILD_PART_TWO
          Portion of build spec after underscore
static boolean IS_MAC_OS
          Public access to whether the system is considered to be running on a MAC.
static int MAJOR_MINOR_LENGTH
          Length of the major.minor version spec test
static int MAJOR_PART
          Major version part
static int MINOR_PART
          Minor version part
static int VERSION_FULL_LENGTH
          Number of version specification components
 
Fields inherited from class ice.util.AbstractVersion
_versionParts
 
Method Summary
static JavaVersion getVersion(String versionString)
          Retrieve an instance of the Version class from a version string of the format:
static JavaVersion getVersionFromHex(String versionString)
          Retrieve an instance of the Version class from a version string of the format:
static JavaVersion getVMVersion()
          Retrieve a Version object initialized with the value of the system property "java.version"
static boolean isV12orGreater()
          Convenience method to determine if this is at least a 1.2 compatible platform.
static boolean isV13orGreater()
          Convenience method to determine if this is at least a 1.3 compatible platform.
static boolean isV14orGreater()
          Convenience method to determine if this is at least a 1.4 compatible platform.
static boolean isV15orGreater()
          Convenience method to determine if this is at least a 1.5 compatible platform.
 String toString()
          Retrieve a String representation of this Version
 
Methods inherited from class ice.util.AbstractVersion
compareTo, getParts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAJOR_PART

public static final int MAJOR_PART
Major version part

See Also:
Constant Field Values

MINOR_PART

public static final int MINOR_PART
Minor version part

See Also:
Constant Field Values

BUILD_PART_ONE

public static final int BUILD_PART_ONE
Portion of build spec before the underscore

See Also:
Constant Field Values

BUILD_PART_TWO

public static final int BUILD_PART_TWO
Portion of build spec after underscore

See Also:
Constant Field Values

VERSION_FULL_LENGTH

public static final int VERSION_FULL_LENGTH
Number of version specification components

See Also:
Constant Field Values

MAJOR_MINOR_LENGTH

public static final int MAJOR_MINOR_LENGTH
Length of the major.minor version spec test

See Also:
Constant Field Values

IS_MAC_OS

public static boolean IS_MAC_OS
Public access to whether the system is considered to be running on a MAC.

Method Detail

getVMVersion

public static JavaVersion getVMVersion()
Retrieve a Version object initialized with the value of the system property "java.version"

Returns:
a Version object filled with the current VM's version

getVersion

public static JavaVersion getVersion(String versionString)
Retrieve an instance of the Version class from a version string of the format:

XX.YY.ZZ_AA

where:

Parameters:
versionString - The String containing the version specification
Returns:
An instance of Version initialized with the version specification from the String
Throws:
NumberFormatException - if any portion of the version specification is unparsable

getVersionFromHex

public static JavaVersion getVersionFromHex(String versionString)
Retrieve an instance of the Version class from a version string of the format:

AAAA-BBBB-CCCC

where:

Version 1.4.1_05 is represented by 0014-0001-0005

Parameters:
versionString - The String containing the version specification
Returns:
An instance of Version initialized with the version specification from the String
Throws:
NumberFormatException - If the format of the Version string is invalid

isV12orGreater

public static boolean isV12orGreater()
Convenience method to determine if this is at least a 1.2 compatible platform. This method checks that the value of the runtime property 'java.version' is at least 1.2.0.0

Returns:
true if the VM is currently v1.2 or greater

isV13orGreater

public static boolean isV13orGreater()
Convenience method to determine if this is at least a 1.3 compatible platform. This method checks that the value of the runtime property 'java.version' is at least 1.3.0.0

Returns:
true if the VM is currently v1.3 or greater

isV14orGreater

public static boolean isV14orGreater()
Convenience method to determine if this is at least a 1.4 compatible platform. This method checks that the value of the runtime property 'java.version' is at least 1.4.0.0

Returns:
true if the VM is currently v1.4 or greater

isV15orGreater

public static boolean isV15orGreater()
Convenience method to determine if this is at least a 1.5 compatible platform. This method checks that the value of the runtime property 'java.version' is at least 1.5.0.0

Returns:
true if the VM is currently v1.5 or greater

toString

public String toString()
Retrieve a String representation of this Version

Returns:
A string with the format X.Y.Z_A