Clover coverage report - Common - 1.0.0
Coverage timestamp: sam. déc. 27 2003 15:13:46 CET
file stats: LOC: 92   Methods: 4
NCLOC: 40   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Platform.java 66,7% 77,8% 75% 73,7%
coverage coverage
 1   
 /*
 2   
  * EJTools, the Enterprise Java Tools
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at www.gnu.org.
 6   
  */
 7   
 package org.ejtools.util;
 8   
 
 9   
 
 10   
 /**
 11   
  * Description of the Class
 12   
  *
 13   
  * @author    Laurent Etiemble
 14   
  * @version   $Revision: 1.2 $
 15   
  */
 16   
 public class Platform
 17   
 {
 18   
    /** Description of the Field */
 19   
    private static String JAVA_VERSION;
 20   
    /** Description of the Field */
 21   
    public final static boolean IS_JAVA_1_1 = Platform.getJavaVersionMatches(Platform.JAVA_1_1);
 22   
    /** Description of the Field */
 23   
    public final static boolean IS_JAVA_1_2 = Platform.getJavaVersionMatches(Platform.JAVA_1_2);
 24   
    /** Description of the Field */
 25   
    public final static boolean IS_JAVA_1_3 = Platform.getJavaVersionMatches(Platform.JAVA_1_3);
 26   
    /** Description of the Field */
 27   
    public final static boolean IS_JAVA_1_4 = Platform.getJavaVersionMatches(Platform.JAVA_1_4);
 28   
    /** Description of the Field */
 29   
    public final static boolean IS_JAVA_1_5 = Platform.getJavaVersionMatches(Platform.JAVA_1_5);
 30   
    /** Description of the Field */
 31   
    public final static String JAVA_1_1 = "1.1";
 32   
    /** Description of the Field */
 33   
    public final static String JAVA_1_2 = "1.2";
 34   
    /** Description of the Field */
 35   
    public final static String JAVA_1_3 = "1.3";
 36   
    /** Description of the Field */
 37   
    public final static String JAVA_1_4 = "1.4";
 38   
    /** Description of the Field */
 39   
    public final static String JAVA_1_5 = "1.5";
 40   
 
 41   
 
 42   
    /** Avoid instantiation */
 43  0
    private Platform() { }
 44   
 
 45   
 
 46   
    /**
 47   
     * Gets the javaVersion attribute of the Platform class
 48   
     *
 49   
     * @return   The javaVersion value
 50   
     */
 51  88
    public static String getJavaVersion()
 52   
    {
 53  88
       if (JAVA_VERSION == null)
 54   
       {
 55  8
          JAVA_VERSION = System.getProperty("java.version");
 56   
       }
 57  88
       return JAVA_VERSION;
 58   
    }
 59   
 
 60   
 
 61   
    /**
 62   
     * Gets the javaVersionCompatible attribute of the Platform class
 63   
     *
 64   
     * @param version  Description of the Parameter
 65   
     * @return         The javaVersionCompatible value
 66   
     */
 67  40
    public static boolean isJavaVersionCompatible(String version)
 68   
    {
 69  40
       if (getJavaVersion() == null)
 70   
       {
 71  0
          return false;
 72   
       }
 73  40
       return (JAVA_VERSION.compareTo(version) >= 0);
 74   
    }
 75   
 
 76   
 
 77   
    /**
 78   
     * Gets the javaVersionMatches attribute of the Platform class
 79   
     *
 80   
     * @param versionPrefix  Description of the Parameter
 81   
     * @return               The javaVersionMatches value
 82   
     */
 83  40
    private static boolean getJavaVersionMatches(String versionPrefix)
 84   
    {
 85  40
       if (getJavaVersion() == null)
 86   
       {
 87  0
          return false;
 88   
       }
 89  40
       return JAVA_VERSION.startsWith(versionPrefix);
 90   
    }
 91   
 }
 92