edu.umd.cs.findbugs

Class JavaVersion

public class JavaVersion extends Object

Support for finding out what version of Java we're running on.
Field Summary
static JavaVersionJAVA_1_5
Constant for Java 1.5 (Tiger).
Constructor Summary
JavaVersion(String versionString)
Constructor.
JavaVersion(int major, int minor)
Constructor.
Method Summary
intgetMajor()
Get the major version number.
intgetMinor()
Get the minor version number.
StringgetRest()
Get the rest of the version string after the major and minor numbers.
static JavaVersiongetRuntimeVersion()
Get the version of Java that we are currently running under.
booleanisSameOrNewerThan(JavaVersion other)
Return whether the Java version represented by this object is at least as recent as the one given.

Field Detail

JAVA_1_5

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

Constructor Detail

JavaVersion

public JavaVersion(String versionString)
Constructor.

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

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 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

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.