View Javadoc

1   package com.atlassian.plugin.util;
2   
3   /**
4    * A simple utility for comparing a java version number to the running version.
5    */
6   public class JavaVersionUtils
7   {
8       private static final Float SPEC_VERSION = Float.valueOf(System.getProperty("java.specification.version"));
9   
10      public static boolean satisfiesMinVersion(float versionNumber)
11      {
12          return SPEC_VERSION >= versionNumber;
13      }
14  
15      public static Float resolveVersionFromString(String versionStr)
16      {
17          try
18          {
19              return Float.valueOf(versionStr);
20          }
21          catch(Exception e)
22          {
23              return null;
24          }
25      }
26  }