1 22 package org.jboss.util.platform; 23 24 25 46 public final class Java 47 { 48 49 private Java() {} 50 51 52 public static final int VERSION_1_0 = 0x01; 53 54 55 public static final int VERSION_1_1 = 0x02; 56 57 58 public static final int VERSION_1_2 = 0x03; 59 60 61 public static final int VERSION_1_3 = 0x04; 62 63 64 public static final int VERSION_1_4 = 0x05; 65 66 67 public static final int VERSION_1_5 = 0x06; 68 69 74 private static final int VERSION; 75 76 77 static 78 { 79 int version = VERSION_1_0; 81 82 try 83 { 84 Class.forName("java.lang.Void"); 86 version = VERSION_1_1; 87 88 Class.forName("java.lang.ThreadLocal"); 90 version = VERSION_1_2; 91 92 Class.forName("java.lang.StrictMath"); 94 version = VERSION_1_3; 95 96 Class.forName("java.lang.StackTraceElement"); 98 version = VERSION_1_4; 99 100 Class.forName("java.lang.Enum"); 102 version = VERSION_1_5; 103 } 104 catch (ClassNotFoundException ignore) 105 { 106 } 107 VERSION = version; 108 } 109 110 115 public static int getVersion() 116 { 117 return VERSION; 118 } 119 120 127 public static boolean isVersion(final int version) 128 { 129 return VERSION == version; 130 } 131 132 139 public static boolean isCompatible(final int version) 140 { 141 return VERSION >= version; 143 } 144 } 145 | Popular Tags |