|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<JavaVersion>
edu.rice.cs.plt.reflect.JavaVersion
public enum JavaVersion
A representation of a major Java version, with methods for parsing version number strings.
| Nested Class Summary | |
|---|---|
static class |
JavaVersion.FullVersion
A full Java version, implemented for the sake of comparison between version numbers. |
static class |
JavaVersion.VendorType
The vendor of this version. |
| Enum Constant Summary | |
|---|---|
FUTURE
|
|
JAVA_1_1
|
|
JAVA_1_2
|
|
JAVA_1_3
|
|
JAVA_1_4
|
|
JAVA_5
|
|
JAVA_6
|
|
JAVA_7
|
|
UNRECOGNIZED
|
|
| Field Summary | |
|---|---|
static JavaVersion |
CURRENT
The currently-available Java version, based on the "java.class.version" property. |
static JavaVersion.FullVersion |
CURRENT_FULL
The currently-available Java version, based on the "java.version" property. |
| Method Summary | |
|---|---|
JavaVersion.FullVersion |
fullVersion()
Returns a FullVersion that corresponds to this JavaVersion, e.g. |
static JavaVersion |
parseClassVersion(File classFile)
Produce the JavaVersion corresponding to the given class file. |
static JavaVersion |
parseClassVersion(InputStream is)
Produce the JavaVersion corresponding to the given class file. |
static JavaVersion |
parseClassVersion(int major,
int minor)
Produce the JavaVersion corresponding to the given class version pair. |
static JavaVersion |
parseClassVersion(String text)
Produce the JavaVersion corresponding to the given class version string. |
static JavaVersion.FullVersion |
parseFullVersion(String text)
Produce the JavaVersion.FullVersion corresponding to the given version string. |
static JavaVersion.FullVersion |
parseFullVersion(String java_version,
String java_runtime_name,
String java_vm_vendor)
Produce the JavaVersion.FullVersion corresponding to the given version string. |
static JavaVersion.FullVersion |
parseFullVersion(String java_version,
String java_runtime_name,
String java_vm_vendor,
File location)
Produce the JavaVersion.FullVersion corresponding to the given version string. |
boolean |
supports(JavaVersion v)
true iff this version is at least as recent as v, and thus can be expected to
support v's APIs (as long as the required features are backwards-compatible) |
String |
toString()
Prepend "Java " to the version number string |
static JavaVersion |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static JavaVersion[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
abstract String |
versionString()
Produce the version number as a string |
| Methods inherited from class java.lang.Enum |
|---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Enum Constant Detail |
|---|
public static final JavaVersion UNRECOGNIZED
public static final JavaVersion JAVA_1_1
public static final JavaVersion JAVA_1_2
public static final JavaVersion JAVA_1_3
public static final JavaVersion JAVA_1_4
public static final JavaVersion JAVA_5
public static final JavaVersion JAVA_6
public static final JavaVersion JAVA_7
public static final JavaVersion FUTURE
| Field Detail |
|---|
public static final JavaVersion CURRENT
"java.class.version" property. Ideally, a true
result for JavaVersion.CURRENT.supports(v) implies that all APIs associated with that version are
available at runtime. However, we do not attempt to (and cannot, in general) guarantee that the boot class path
or Java installation have not been modified to only support certain API classes.
public static final JavaVersion.FullVersion CURRENT_FULL
"java.version" property.
| Method Detail |
|---|
public static JavaVersion[] values()
for (JavaVersion c : JavaVersion.values()) System.out.println(c);
public static JavaVersion valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic boolean supports(JavaVersion v)
true iff this version is at least as recent as v, and thus can be expected to
support v's APIs (as long as the required features are backwards-compatible)
public abstract String versionString()
public String toString()
"Java " to the version number string
toString in class Enum<JavaVersion>public JavaVersion.FullVersion fullVersion()
public static JavaVersion parseClassVersion(String text)
JavaVersion corresponding to the given class version string. For example,
"49.0" maps to JAVA_5. If the text cannot be parsed, UNRECOGNIZED will be
returned.
public static JavaVersion parseClassVersion(int major,
int minor)
JavaVersion corresponding to the given class version pair. For example,
49,0 maps to JAVA_5. If the pair cannot be matched, UNRECOGNIZED will be
returned.
public static JavaVersion parseClassVersion(File classFile)
JavaVersion corresponding to the given class file.
public static JavaVersion parseClassVersion(InputStream is)
JavaVersion corresponding to the given class file.
public static JavaVersion.FullVersion parseFullVersion(String java_version,
String java_runtime_name,
String java_vm_vendor,
File location)
JavaVersion.FullVersion corresponding to the given version string. Accepts
input of the form "1.6.0", "1.4.2_10", or "1.5.0_05-ea". The underscore may be replaced by a dot.
If the text cannot be parsed, a trivial version with major version UNRECOGNIZED is returned.
The location of the JDK, which may be null, will be stored in the version.
public static JavaVersion.FullVersion parseFullVersion(String java_version,
String java_runtime_name,
String java_vm_vendor)
JavaVersion.FullVersion corresponding to the given version string. Accepts
input of the form "1.6.0", "1.4.2_10", or "1.5.0_05-ea". The underscore may be replaced by a dot.
If the text cannot be parsed, a trivial version with major version UNRECOGNIZED is returned.
The location of the JDK is null and will be stored in the version.
public static JavaVersion.FullVersion parseFullVersion(String text)
JavaVersion.FullVersion corresponding to the given version string. Accepts
input of the form "1.6.0", "1.4.2_10", or "1.5.0_05-ea". The underscore may be replaced by a dot.
If the text cannot be parsed, a trivial version with major version UNRECOGNIZED is returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||