1 21 23 30 package oracle.toplink.essentials; 31 32 public class Version { 33 private static final String CopyrightString = "Copyright (c) 1998, 2006, Oracle. All rights reserved."; 35 36 private static String product = "Oracle TopLink Essentials"; 39 private static final String version = "2006.8"; 40 private static final String buildNumber = "060830"; 41 42 43 public static final int JDK_VERSION_NOT_SET = 0; 44 public static final int JDK_1_3 = 1; 45 public static final int JDK_1_4 = 2; 46 public static final int JDK_1_5 = 3; 47 public static int JDK_VERSION = JDK_VERSION_NOT_SET; 48 49 public static String getProduct() { 50 return product; 51 } 52 53 public static void setProduct(String ProductName) { 54 product = ProductName; 55 } 56 57 public static String getVersion() { 58 return version; 59 } 60 61 public static String getBuildNumber() { 62 return buildNumber; 63 } 64 65 69 public static int getJDKVersion() { 70 if (JDK_VERSION == JDK_VERSION_NOT_SET) { 71 String version = System.getProperty("java.version"); 72 if ((version != null) && version.startsWith("1.5")) { 73 useJDK15(); 74 } else if ((version != null) && version.startsWith("1.4")) { 75 useJDK14(); 76 } else { 77 useJDK13(); 78 } 79 } 80 return JDK_VERSION; 81 } 82 83 public static void useJDK13() { 84 JDK_VERSION = JDK_1_3; 85 } 86 87 public static void useJDK14() { 88 JDK_VERSION = JDK_1_4; 89 } 90 91 public static void useJDK15() { 92 JDK_VERSION = JDK_1_5; 93 } 94 95 public static boolean isJDK13() { 96 return getJDKVersion() == JDK_1_3; 97 } 98 99 public static boolean isJDK14() { 100 return getJDKVersion() == JDK_1_4; 101 } 102 103 public static boolean isJDK15() { 104 return getJDKVersion() == JDK_1_5; 105 } 106 } 107 | Popular Tags |