private Analyzer getLuceneAnalyzer() throws ProviderException { try { Class clazz = ClassUtil.findClass("", m_analyzerClass); Constructor constructor = clazz.getConstructor(Version.LUCENE_36.getClass()); Analyzer analyzer = (Analyzer) constructor.newInstance(Version.LUCENE_36); return analyzer; } catch (Exception e) { String msg = "Could not get LuceneAnalyzer class " + m_analyzerClass + ", reason: "; log.error(msg, e); throw new ProviderException(msg + e); } }
/** * Helper method to use for locating Class for given name. Should be used instead of basic <code> * Class.forName(className);</code> as it can try using contextual class loader, or use * platform-specific workarounds (like on Android, GAE). */ public Class<?> findClass(String className) throws ClassNotFoundException { // By default, delegate to ClassUtil: can be overridden with custom handling return ClassUtil.findClass(className); }