org.apache.commons.lang3
Enum JavaVersion

java.lang.Object
  extended by java.lang.Enum<JavaVersion>
      extended by org.apache.commons.lang3.JavaVersion
All Implemented Interfaces:
Serializable, Comparable<JavaVersion>

public enum JavaVersion
extends Enum<JavaVersion>

An enum representing all the versions of the Java specification. This is intended to mirror available values from the java.specification.version System property.

Since:
3.0
Version:
$Id: $

Enum Constant Summary
JAVA_0_9
          The Java version reported by Android.
JAVA_1_1
           
JAVA_1_2
           
JAVA_1_3
           
JAVA_1_4
           
JAVA_1_5
           
JAVA_1_6
           
JAVA_1_7
           
JAVA_1_8
           
 
Method Summary
 boolean atLeast(JavaVersion requiredVersion)
          Whether this version of Java is at least the version of Java passed in.
 String toString()
          The string value is overridden to return the standard name.
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.
 
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

JAVA_0_9

public static final JavaVersion JAVA_0_9
The Java version reported by Android. This is not an official Java version number.


JAVA_1_1

public static final JavaVersion JAVA_1_1

JAVA_1_2

public static final JavaVersion JAVA_1_2

JAVA_1_3

public static final JavaVersion JAVA_1_3

JAVA_1_4

public static final JavaVersion JAVA_1_4

JAVA_1_5

public static final JavaVersion JAVA_1_5

JAVA_1_6

public static final JavaVersion JAVA_1_6

JAVA_1_7

public static final JavaVersion JAVA_1_7

JAVA_1_8

public static final JavaVersion JAVA_1_8
Method Detail

values

public static JavaVersion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (JavaVersion c : JavaVersion.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static JavaVersion valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

atLeast

public boolean atLeast(JavaVersion requiredVersion)

Whether this version of Java is at least the version of Java passed in.

For example:
myVersion.atLeast(JavaVersion.JAVA_1_4)

Parameters:
requiredVersion - the version to check against, not null
Returns:
true if this version is equal to or greater than the specified version

toString

public String toString()

The string value is overridden to return the standard name.

For example, "1.5".

Overrides:
toString in class Enum<JavaVersion>
Returns:
the name, not null


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.