edu.umd.cs.findbugs
Class JavaVersion

java.lang.Object
  extended by edu.umd.cs.findbugs.JavaVersion

public class JavaVersion
extends java.lang.Object

Support for finding out what version of Java we're running on.


Field Summary
static JavaVersion JAVA_1_5
          Constant for Java 1.5 (Tiger).
private  int major
           
private  int minor
           
private static java.util.regex.Pattern PATTERN
           
private  java.lang.String rest
           
private static JavaVersion runtimeVersion
          Constant for the Java version we're currently running on.
 
Constructor Summary
JavaVersion(int major, int minor)
          Constructor.
JavaVersion(java.lang.String versionString)
          Constructor.
 
Method Summary
 int getMajor()
          Get the major version number.
 int getMinor()
          Get the minor version number.
 java.lang.String getRest()
          Get the rest of the version string after the major and minor numbers.
static JavaVersion getRuntimeVersion()
          Get the version of Java that we are currently running under.
 boolean isSameOrNewerThan(JavaVersion other)
          Return whether the Java version represented by this object is at least as recent as the one given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN

private static final java.util.regex.Pattern PATTERN

major

private final int major

minor

private final int minor

rest

private final java.lang.String rest

runtimeVersion

private static JavaVersion runtimeVersion
Constant for the Java version we're currently running on.


JAVA_1_5

public static final JavaVersion JAVA_1_5
Constant for Java 1.5 (Tiger).

Constructor Detail

JavaVersion

public JavaVersion(java.lang.String versionString)
            throws JavaVersionException
Constructor.

Parameters:
versionString - a version string, as returned from the java.version system property: e.g., "1.4.2_04"
Throws:
JavaVersionException

JavaVersion

public JavaVersion(int major,
                   int minor)
Constructor.

Parameters:
major - major version
minor - minor version
Method Detail

getMajor

public int getMajor()
Get the major version number.


getMinor

public int getMinor()
Get the minor version number.


getRest

public java.lang.String getRest()
Get the rest of the version string after the major and minor numbers.


getRuntimeVersion

public static JavaVersion getRuntimeVersion()
Get the version of Java that we are currently running under.


isSameOrNewerThan

public boolean isSameOrNewerThan(JavaVersion other)
Return whether the Java version represented by this object is at least as recent as the one given.

Parameters:
other - another JavaVersion
Returns:
true if this Java version is at least as recent as the one given