Clover coverage report - J2EE Deployment - 1.0.0
Coverage timestamp: sam. déc. 27 2003 15:14:34 CET
file stats: LOC: 147   Methods: 8
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ModuleType.java - 81,2% 62,5% 75%
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 javax.enterprise.deploy.shared;
 8   
 
 9   
 
 10   
 /**
 11   
  * Class ModuleTypes defines enumeration values for the J2EE module types.
 12   
  *
 13   
  * @author    Laurent Etiemble
 14   
  * @version   $Revision: 1.1 $
 15   
  * @since     1.0
 16   
  */
 17   
 public class ModuleType
 18   
 {
 19   
    /** Index value */
 20   
    private int value;
 21   
 
 22   
    /** The module is an Client Application archive. */
 23   
    public final static ModuleType CAR;
 24   
    /** The module is an EAR archive. */
 25   
    public final static ModuleType EAR;
 26   
    /** The module is an Enterprise Java Bean archive. */
 27   
    public final static ModuleType EJB;
 28   
    /** The module is an Connector archive. */
 29   
    public final static ModuleType RAR;
 30   
    /** The module is an Web Application archive. */
 31   
    public final static ModuleType WAR;
 32   
 
 33   
    /** Internal table for extensions values */
 34   
    private final static String[] extensionTable;
 35   
    /** Internal table for string values */
 36   
    private final static String[] stringTable;
 37   
    /** Internal table for values */
 38   
    private final static ModuleType[] valueTable;
 39   
 
 40   
 
 41   
    /**
 42   
     * Construct a new enumeration value with the given integer value.
 43   
     *
 44   
     * @param value  Integer value.
 45   
     */
 46  40
    protected ModuleType(int value)
 47   
    {
 48  40
       this.value = value;
 49   
    }
 50   
 
 51   
 
 52   
    /**
 53   
     * Returns this enumeration extension value's string value.
 54   
     *
 55   
     * @return   The extension value
 56   
     */
 57  40
    public String getModuleExtension()
 58   
    {
 59  40
       return extensionTable[value];
 60   
    }
 61   
 
 62   
 
 63   
    /**
 64   
     * Returns this enumeration value's integer value.
 65   
     *
 66   
     * @return   the value
 67   
     */
 68  40
    public int getValue()
 69   
    {
 70  40
       return this.value;
 71   
    }
 72   
 
 73   
 
 74   
    /**
 75   
     * Return the string name of this ModuleType or the integer value if outside the
 76   
     * bounds of the table.
 77   
     *
 78   
     * @return   The String representation
 79   
     */
 80  40
    public String toString()
 81   
    {
 82  40
       return stringTable[value];
 83   
    }
 84   
 
 85   
 
 86   
    /**
 87   
     * Returns the enumeration value table for class ModuleType
 88   
     *
 89   
     * @return   Enumeration table of the values
 90   
     */
 91  0
    protected ModuleType[] getEnumValueTable()
 92   
    {
 93  0
       return valueTable;
 94   
    }
 95   
 
 96   
 
 97   
    /**
 98   
     * Returns the lowest integer value used by this enumeration value's enumeration
 99   
     * class. <p>
 100   
     *
 101   
     * The default implementation returns 0.</p>
 102   
     *
 103   
     * @return   the offset of the lowest enumeration value.
 104   
     */
 105  0
    protected int getOffset()
 106   
    {
 107  0
       return 0;
 108   
    }
 109   
 
 110   
 
 111   
    /**
 112   
     * Returns the string table for class ModuleType
 113   
     *
 114   
     * @return   The String representation table values
 115   
     */
 116  0
    protected String[] getStringTable()
 117   
    {
 118  0
       return stringTable;
 119   
    }
 120   
 
 121   
 
 122   
    /**
 123   
     * Return an object of the specified value.
 124   
     *
 125   
     * @param value  a designator for the object.
 126   
     * @return       The corresponding ModuleType
 127   
     */
 128  40
    public static ModuleType getModuleType(int value)
 129   
    {
 130  40
       return valueTable[value];
 131   
    }
 132   
 
 133   
    /** Static block to initialize constants and to fill arrays. */
 134   
    static
 135   
    {
 136  8
       EAR = new ModuleType(0);
 137  8
       EJB = new ModuleType(1);
 138  8
       CAR = new ModuleType(2);
 139  8
       RAR = new ModuleType(3);
 140  8
       WAR = new ModuleType(4);
 141   
 
 142  8
       valueTable = (new ModuleType[]{EAR, EJB, CAR, RAR, WAR});
 143  8
       stringTable = new String[]{"EAR", "EJB", "CAR", "RAR", "WAR"};
 144  8
       extensionTable = new String[]{"ear", "jar", "car", "rar", "war"};
 145   
    }
 146   
 }
 147