01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: JavaSpecificationUtils.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.tools;
09:
10: /**
11: * Utility class to obtain information about the currently running Java
12: * specification.
13: *
14: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
15: * @version $Revision: 3634 $
16: * @since 1.6
17: */
18: public abstract class JavaSpecificationUtils {
19: /**
20: * Retrieves the version of the currently running JVM.
21: *
22: * @return the version of the current JVM as a double
23: * @since 1.6
24: */
25: public static double getVersion() {
26: return Double.parseDouble(System
27: .getProperty("java.specification.version"));
28: }
29:
30: /**
31: * Checks if the currently running JVM is at least complient with JDK 1.5.
32: *
33: * @return <code>true</code> if the JVM is complient with JDK 1.5; or
34: * <p><code>false</code> otherwise
35: * @since 1.6
36: */
37: public static boolean isAtLeastJdk15() {
38: return getVersion() >= 1.5;
39: }
40:
41: /**
42: * Checks if the currently running JVM is at least complient with JDK 1.6.
43: *
44: * @return <code>true</code> if the JVM is complient with JDK 1.6; or
45: * <p><code>false</code> otherwise
46: * @since 1.6
47: */
48: public static boolean isAtLeastJdk16() {
49: return getVersion() >= 1.6;
50: }
51: }
|