Package opennlp.tools.util.ext
Class ExtensionLoader
java.lang.Object
opennlp.tools.util.ext.ExtensionLoader
The
ExtensionLoader
is responsible to load extensions to the OpenNLP library.
Note: Do not use this class, internal use only!
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
instantiateExtension
(Class<T> clazz, String extensionClassName) Instantiates a user provided extension to OpenNLP.
-
Method Details
-
instantiateExtension
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
Singleton
pattern: a static field namedINSTANCE
that returns an object of the typeExtensionLoader
.- Parameters:
clazz
- A reference toClass<T>
.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.
-