Package opennlp.tools.util.ext
Class ExtensionLoader
- java.lang.Object
-
- opennlp.tools.util.ext.ExtensionLoader
-
@Internal public class ExtensionLoader extends Object
TheExtensionLoaderis responsible to load extensions to the OpenNLP library.Note: Do not use this class, internal use only!
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TinstantiateExtension(Class<T> clazz, String extensionClassName)Instantiates a user provided extension to OpenNLP.
-
-
-
Method Detail
-
instantiateExtension
public static <T> T instantiateExtension(Class<T> clazz, String extensionClassName)
Instantiates a user provided extension to OpenNLP.The extension is loaded from the class path.
Initially, the load is conducted using the public no-arg constructor. If no such constructor is not found, it is checked if the class follows the
Singletonpattern: a static field namedINSTANCEthat returns an object of the typeExtensionLoader.- Parameters:
clazz- A reference toClass.extensionClassName- The (fully-qualified) name of the class by which the extension shall be loaded.- Returns:
- the instance of the extension class
- Throws:
ExtensionNotLoadedException- Thrown if the load operation failed.
-
-