@Test public void getAnalyzerFactoryClass() { Class<?> fcForSh = AnalyzerGuru.getFactoryClass("Sh"); Class<?> fcForShAnalyzer = AnalyzerGuru.getFactoryClass("ShAnalyzer"); Class<?> fcSimpleName = AnalyzerGuru.getFactoryClass("ShAnalyzerFactory"); assertEquals(ShAnalyzerFactory.class, fcForSh); assertEquals(ShAnalyzerFactory.class, fcForShAnalyzer); assertEquals(ShAnalyzerFactory.class, fcSimpleName); Class<?> fc = AnalyzerGuru.getFactoryClass("UnknownAnalyzerFactory"); assertNull(fc); }
public static Class<?> getFactoryClass(String simpleName) { Class<?> factoryClass = null; if (analysisPkgNames.isEmpty()) { Package[] p = Package.getPackages(); for (Package pp : p) { String pname = pp.getName(); if (pname.contains(".analysis.")) { analysisPkgNames.add(pname); } } } if (!simpleName.contains("Analyzer")) { simpleName += "Analyzer"; } if (!simpleName.contains("Factory")) { simpleName += "Factory"; } for (String aPackage : analysisPkgNames) { try { String fqn = aPackage + "." + simpleName; factoryClass = Class.forName(fqn); break; } catch (ClassNotFoundException e) { } } return factoryClass; }
AnalyzerGuru { public static Class<?> getFactoryClass(String simpleName) { Class<?> factoryClass = null; if (analysisPkgNames.isEmpty()) { Package[] p = Package.getPackages(); for (Package pp : p) { String pname = pp.getName(); if (pname.contains(".analysis.")) { analysisPkgNames.add(pname); } } } if (!simpleName.contains("Analyzer")) { simpleName += "Analyzer"; } if (!simpleName.contains("Factory")) { simpleName += "Factory"; } for (String aPackage : analysisPkgNames) { try { String fqn = aPackage + "." + simpleName; factoryClass = Class.forName(fqn); break; } catch (ClassNotFoundException e) { } } return factoryClass; } }
AnalyzerGuru { public static Class<?> getFactoryClass(String simpleName) { Class<?> factoryClass = null; if (analysisPkgNames.isEmpty()) { Package[] p = Package.getPackages(); for (Package pp : p) { String pname = pp.getName(); if (pname.contains(".analysis.")) { analysisPkgNames.add(pname); } } } if (!simpleName.contains("Analyzer")) { simpleName += "Analyzer"; } if (!simpleName.contains("Factory")) { simpleName += "Factory"; } for (String aPackage : analysisPkgNames) { try { String fqn = aPackage + "." + simpleName; factoryClass = Class.forName(fqn); break; } catch (ClassNotFoundException e) { } } return factoryClass; }  }
AnalyzerGuru { public static Class<?> getFactoryClass(String simpleName) { Class<?> factoryClass = null; if (analysisPkgNames.isEmpty()) { Package[] p = Package.getPackages(); for (Package pp : p) { String pname = pp.getName(); if (pname.contains(".analysis.")) { analysisPkgNames.add(pname); } } } if (!simpleName.contains("Analyzer")) { simpleName += "Analyzer"; } if (!simpleName.contains("Factory")) { simpleName += "Factory"; } for (String aPackage : analysisPkgNames) { try { String fqn = aPackage + "." + simpleName; factoryClass = Class.forName(fqn); break; } catch (ClassNotFoundException e) { } } return factoryClass; }  static long getVersionNo(); static long getAnalyzerVersionNo(String fileTypeName); static Map<String, Long> getAnalyzersVersionNos(); static Map<String, AnalyzerFactory> getExtensionsMap(); static Map<String, AnalyzerFactory> getPrefixesMap(); static Map<String, AnalyzerFactory> getMagicsMap(); static List<Matcher> getAnalyzerFactoryMatchers(); static Map<String, String> getfileTypeDescriptions(); List<AnalyzerFactory> getAnalyzerFactories(); static void addPrefix(String prefix, AnalyzerFactory factory); static void addExtension(String extension, AnalyzerFactory factory); static LangMap getLangMap(); static AbstractAnalyzer getAnalyzer(); static AbstractAnalyzer getAnalyzer(String fileTypeName); static AbstractAnalyzer getAnalyzer(InputStream in, String file); static void returnAnalyzers(); void populateDocument(Document doc, File file, String path,
        AbstractAnalyzer fa, Writer xrefOut); static void writeXref(AnalyzerFactory factory, Reader in,
            Writer out, Definitions defs,
            Annotation annotation, Project project); static void writeDumpedXref(String contextPath,
            AnalyzerFactory factory, Reader in, Writer out,
            Definitions defs, Annotation annotation, Project project); static AbstractAnalyzer.Genre getGenre(String file); static AbstractAnalyzer.Genre getGenre(InputStream in); static AbstractAnalyzer.Genre getGenre(AnalyzerFactory factory); static AnalyzerFactory findByFileTypeName(String fileTypeName); static AnalyzerFactory findFactory(String factoryClassName); static Class<?> getFactoryClass(String simpleName); static AnalyzerFactory find(InputStream in, String file); static AnalyzerFactory find(String file); static AnalyzerFactory find(InputStream in); }
AnalyzerGuru { public static Class<?> getFactoryClass(String simpleName) { Class<?> factoryClass = null; if (analysisPkgNames.isEmpty()) { Package[] p = Package.getPackages(); for (Package pp : p) { String pname = pp.getName(); if (pname.contains(".analysis.")) { analysisPkgNames.add(pname); } } } if (!simpleName.contains("Analyzer")) { simpleName += "Analyzer"; } if (!simpleName.contains("Factory")) { simpleName += "Factory"; } for (String aPackage : analysisPkgNames) { try { String fqn = aPackage + "." + simpleName; factoryClass = Class.forName(fqn); break; } catch (ClassNotFoundException e) { } } return factoryClass; }  static long getVersionNo(); static long getAnalyzerVersionNo(String fileTypeName); static Map<String, Long> getAnalyzersVersionNos(); static Map<String, AnalyzerFactory> getExtensionsMap(); static Map<String, AnalyzerFactory> getPrefixesMap(); static Map<String, AnalyzerFactory> getMagicsMap(); static List<Matcher> getAnalyzerFactoryMatchers(); static Map<String, String> getfileTypeDescriptions(); List<AnalyzerFactory> getAnalyzerFactories(); static void addPrefix(String prefix, AnalyzerFactory factory); static void addExtension(String extension, AnalyzerFactory factory); static LangMap getLangMap(); static AbstractAnalyzer getAnalyzer(); static AbstractAnalyzer getAnalyzer(String fileTypeName); static AbstractAnalyzer getAnalyzer(InputStream in, String file); static void returnAnalyzers(); void populateDocument(Document doc, File file, String path,
        AbstractAnalyzer fa, Writer xrefOut); static void writeXref(AnalyzerFactory factory, Reader in,
            Writer out, Definitions defs,
            Annotation annotation, Project project); static void writeDumpedXref(String contextPath,
            AnalyzerFactory factory, Reader in, Writer out,
            Definitions defs, Annotation annotation, Project project); static AbstractAnalyzer.Genre getGenre(String file); static AbstractAnalyzer.Genre getGenre(InputStream in); static AbstractAnalyzer.Genre getGenre(AnalyzerFactory factory); static AnalyzerFactory findByFileTypeName(String fileTypeName); static AnalyzerFactory findFactory(String factoryClassName); static Class<?> getFactoryClass(String simpleName); static AnalyzerFactory find(InputStream in, String file); static AnalyzerFactory find(String file); static AnalyzerFactory find(InputStream in); static final FieldType string_ft_stored_nanalyzed_norms; static final FieldType string_ft_nstored_nanalyzed_norms; }