001: package csdl.jblanket.util;
002:
003: /**
004: * Provides type safety default XML file names used for JBlanket output.
005: * <p>
006: * This class can be used with MethodCategories to match the default file names with the
007: * different method categories available.
008: *
009: * @author Joy M. Agustin
010: * @version $Id: DefaultFileName.java,v 1.1 2004/11/07 00:32:24 timshadel Exp $
011: */
012: public final class DefaultFileName {
013:
014: /** Default file name for this XML file */
015: private String defaultFileName;
016:
017: /** Name of file containing total methods found in the system */
018: public static final DefaultFileName TOTAL_FILE = new DefaultFileName(
019: "totalMethods");
020: /** Output file for methods that are not included in coverage, i.e., abstract and native */
021: public static final DefaultFileName UNTESTABLE_FILE = new DefaultFileName(
022: "untestableMethods");
023: /** Name of file containing methods in user specified excluded classes */
024: public static final DefaultFileName EXCLUDED_FILE = new DefaultFileName(
025: "excludedMethods");
026:
027: /** Name of file containing one-line methods */
028: public static final DefaultFileName ONELINE_FILE = new DefaultFileName(
029: "oneLineMethods");
030: /** Name of file containing constructors */
031: public static final DefaultFileName CONSTRUCTOR_FILE = new DefaultFileName(
032: "constructorMethods");
033: /** Name of file containing individually excluded methods */
034: public static final DefaultFileName EXCLUDE_INDIVIDUAL_FILE = new DefaultFileName(
035: "excludedIndividualMethods");
036:
037: /** Name of file containing total tested methods */
038: public static final DefaultFileName TOTAL_TESTED_FILE = new DefaultFileName(
039: "total.testedMethods");
040: /** Name of file containing total untested methods */
041: public static final DefaultFileName TOTAL_UNTESTED_FILE = new DefaultFileName(
042: "total.untestedMethods");
043: /** Name of file containing total tested methods minus optional exclusions */
044: public static final DefaultFileName TESTED_FILE = new DefaultFileName(
045: "testedMethods");
046: /** Name of file containing total untested methods minus optional exclusions */
047: public static final DefaultFileName UNTESTED_FILE = new DefaultFileName(
048: "untestedMethods");
049:
050: /**
051: * Constructs a new DefaultFileName.
052: *
053: * @param defaultFileName the default file name.
054: */
055: private DefaultFileName(String defaultFileName) {
056: this .defaultFileName = defaultFileName + ".xml";
057: }
058:
059: /**
060: * Returns the default file name for specified <code>category</code>.
061: * For example, 'testedFile' => 'testedMethods.xml'.
062: *
063: * @param category the category who's associated file name is to be retrieved.
064: * @return the default file name for specified <code>category</code>.
065: */
066: public static String getDefaultFileName(String category) {
067:
068: if ("totalFile".equals(category)) {
069: return TOTAL_FILE.toString();
070: } else if ("untestableFile".equals(category)) {
071: return UNTESTABLE_FILE.toString();
072: } else if ("excludedFile".equals(category)) {
073: return EXCLUDED_FILE.toString();
074: } else if ("oneLineFile".equals(category)) {
075: return ONELINE_FILE.toString();
076: } else if ("constructorFile".equals(category)) {
077: return CONSTRUCTOR_FILE.toString();
078: } else if ("excludedIndividualFile".equals(category)) {
079: return EXCLUDE_INDIVIDUAL_FILE.toString();
080: } else if ("total.testedFile".equals(category)) {
081: return TOTAL_TESTED_FILE.toString();
082: } else if ("total.untestedFile".equals(category)) {
083: return TOTAL_UNTESTED_FILE.toString();
084: } else if ("testedFile".equals(category)) {
085: return TESTED_FILE.toString();
086: } else if ("untestedFile".equals(category)) {
087: return UNTESTED_FILE.toString();
088: }
089:
090: return null;
091: }
092:
093: /**
094: * Returns a String representation of this DefaultFileName.
095: *
096: * @return String representation of this DefaultFileName.
097: */
098: public String toString() {
099: return this.defaultFileName;
100: }
101: }
|