01: package org.acm.seguin.pmd.cpd;
02:
03: public class LanguageFactory {
04:
05: public static final String JAVA_KEY = "java";
06: public static final String CPP_KEY = "cpp";
07: public static final String PHP_KEY = "php";
08:
09: public Language createLanguage(String language) {
10: if (language.equals(CPP_KEY)) {
11: return new CPPLanguage();
12: } else if (language.equals(JAVA_KEY)) {
13: return new JavaLanguage();
14: } else if (language.equals(PHP_KEY)) {
15: return new PHPLanguage();
16: }
17: throw new RuntimeException("Can't create language " + language);
18: }
19: }
|