KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > csdl > jblanket > util > DefaultFileName


1 package csdl.jblanket.util;
2
3 /**
4  * Provides type safety default XML file names used for JBlanket output.
5  * <p>
6  * This class can be used with MethodCategories to match the default file names with the
7  * different method categories available.
8  *
9  * @author Joy M. Agustin
10  * @version $Id: DefaultFileName.java,v 1.1 2004/11/07 00:32:24 timshadel Exp $
11  */

12 public final class DefaultFileName {
13   
14   /** Default file name for this XML file */
15   private String JavaDoc defaultFileName;
16
17   /** Name of file containing total methods found in the system */
18   public static final DefaultFileName TOTAL_FILE = new DefaultFileName("totalMethods");
19   /** Output file for methods that are not included in coverage, i.e., abstract and native */
20   public static final DefaultFileName UNTESTABLE_FILE = new DefaultFileName("untestableMethods");
21   /** Name of file containing methods in user specified excluded classes */
22   public static final DefaultFileName EXCLUDED_FILE = new DefaultFileName("excludedMethods");
23   
24   /** Name of file containing one-line methods */
25   public static final DefaultFileName ONELINE_FILE = new DefaultFileName("oneLineMethods");
26   /** Name of file containing constructors */
27   public static final DefaultFileName CONSTRUCTOR_FILE =
28     new DefaultFileName("constructorMethods");
29   /** Name of file containing individually excluded methods */
30   public static final DefaultFileName EXCLUDE_INDIVIDUAL_FILE =
31     new DefaultFileName("excludedIndividualMethods");
32   
33   /** Name of file containing total tested methods */
34   public static final DefaultFileName TOTAL_TESTED_FILE =
35     new DefaultFileName("total.testedMethods");
36   /** Name of file containing total untested methods */
37   public static final DefaultFileName TOTAL_UNTESTED_FILE =
38     new DefaultFileName("total.untestedMethods");
39   /** Name of file containing total tested methods minus optional exclusions */
40   public static final DefaultFileName TESTED_FILE = new DefaultFileName("testedMethods");
41   /** Name of file containing total untested methods minus optional exclusions */
42   public static final DefaultFileName UNTESTED_FILE = new DefaultFileName("untestedMethods");
43
44   /**
45    * Constructs a new DefaultFileName.
46    *
47    * @param defaultFileName the default file name.
48    */

49   private DefaultFileName(String JavaDoc defaultFileName) {
50     this.defaultFileName = defaultFileName + ".xml";
51   }
52   
53   /**
54    * Returns the default file name for specified <code>category</code>.
55    * For example, 'testedFile' => 'testedMethods.xml'.
56    *
57    * @param category the category who's associated file name is to be retrieved.
58    * @return the default file name for specified <code>category</code>.
59    */

60   public static String JavaDoc getDefaultFileName(String JavaDoc category) {
61     
62     if ("totalFile".equals(category)) {
63       return TOTAL_FILE.toString();
64     }
65     else if ("untestableFile".equals(category)) {
66       return UNTESTABLE_FILE.toString();
67     }
68     else if ("excludedFile".equals(category)) {
69       return EXCLUDED_FILE.toString();
70     }
71     else if ("oneLineFile".equals(category)) {
72       return ONELINE_FILE.toString();
73     }
74     else if ("constructorFile".equals(category)) {
75       return CONSTRUCTOR_FILE.toString();
76     }
77     else if ("excludedIndividualFile".equals(category)) {
78       return EXCLUDE_INDIVIDUAL_FILE.toString();
79     }
80     else if ("total.testedFile".equals(category)) {
81       return TOTAL_TESTED_FILE.toString();
82     }
83     else if ("total.untestedFile".equals(category)) {
84       return TOTAL_UNTESTED_FILE.toString();
85     }
86     else if ("testedFile".equals(category)) {
87       return TESTED_FILE.toString();
88     }
89     else if ("untestedFile".equals(category)) {
90       return UNTESTED_FILE.toString();
91     }
92     
93     return null;
94   }
95   
96   /**
97    * Returns a String representation of this DefaultFileName.
98    *
99    * @return String representation of this DefaultFileName.
100    */

101   public String JavaDoc toString() {
102     return this.defaultFileName;
103   }
104 }
105
Popular Tags