Package edu.umd.cs.findbugs
Class JavaVersion
- java.lang.Object
-
- edu.umd.cs.findbugs.JavaVersion
-
public class JavaVersion extends java.lang.ObjectSupport for finding out what version of Java we're running on.
-
-
Field Summary
Fields Modifier and Type Field Description static JavaVersionJAVA_1_5StaticConstant for Java 1.5 (Tiger).
-
Constructor Summary
Constructors Constructor Description JavaVersion(int major, int minor)Constructor.JavaVersion(java.lang.String versionString)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMajor()Get the major version number.intgetMinor()Get the minor version number.java.lang.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.java.lang.StringtoString()
-
-
-
Field Detail
-
JAVA_1_5
public static final JavaVersion JAVA_1_5
StaticConstant for Java 1.5 (Tiger).
-
-
Constructor Detail
-
JavaVersion
public JavaVersion(java.lang.String versionString) throws JavaVersionExceptionConstructor.- Parameters:
versionString- a version string, as returned from thejava.versionsystem property: e.g., "1.4.2_04"- Throws:
JavaVersionException
-
JavaVersion
public JavaVersion(int major, int minor)Constructor.- Parameters:
major- major versionminor- 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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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
-
-