KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > pmd > SourceTypeToRuleLanguageMapper


1 package net.sourceforge.pmd;
2
3 import java.util.Map JavaDoc;
4
5 import net.sourceforge.pmd.util.CollectionUtil;
6
7 /**
8  * Mapping of SourceType to RuleLanguage.
9  *
10  * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
11  */

12 public class SourceTypeToRuleLanguageMapper {
13     /**
14      * Map of SourceType on RuleLanguage.
15      */

16     private static Map JavaDoc mapSourceTypeOnRuleLanguage = CollectionUtil.mapFrom( new Object JavaDoc[][] {
17         { SourceType.JAVA_13, Language.JAVA },
18         { SourceType.JAVA_14, Language.JAVA },
19         { SourceType.JAVA_15, Language.JAVA },
20         { SourceType.JAVA_16, Language.JAVA },
21         { SourceType.JSP, Language.JSP },
22         });
23
24     private SourceTypeToRuleLanguageMapper() {};
25     /**
26      * Get the RuleLanguage that corresponds to the given SourceType.
27      *
28      * @param sourceType the SourceType
29      * @return a RuleLanguage
30      */

31     public static Language getMappedLanguage(SourceType sourceType) {
32         return (Language) mapSourceTypeOnRuleLanguage.get(sourceType);
33     }
34 }
35
Popular Tags