public static final Analyzer createAnalyzer(String className) throws Exception{final Class<? extends Analyzer> clazz = Class.forName(className).asSubclass(Analyzer.class);try {Constructor<? extends Analyzer> cnstr = clazz.getConstructor(Version.class);return cnstr.newInstance(Version.LATEST);} catch (NoSuchMethodException nsme) {return clazz.getConstructor().newInstance();}}

public static final Analyzer createAnalyzer ( String className ) throws Exception { final Class < ? extends Analyzer > clazz = Class . forName ( className ) . asSubclass ( Analyzer . class ) ; try { Constructor < ? extends Analyzer > cnstr = clazz . getConstructor ( Version . class ) ; return cnstr . newInstance ( Version . LATEST ) ; } catch ( NoSuchMethodException nsme ) { return clazz . getConstructor ( ) . newInstance ( ) ; } }
public static Analyzer CreateAnalyzer(string className){Type clazz = Type.GetType(className);try{return (Analyzer)Activator.CreateInstance(clazz,LuceneVersion.LUCENE_CURRENT);}catch (MissingMethodException ){return (Analyzer)Activator.CreateInstance(clazz);}}
