Class ExtensionLoader

java.lang.Object
opennlp.tools.util.ext.ExtensionLoader

@Internal public class ExtensionLoader extends Object
The ExtensionLoader is responsible to load extensions to the OpenNLP library.

Note: Do not use this class, internal use only!

  • Method Details

    • 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 Singleton pattern: a static field named INSTANCE that returns an object of the type ExtensionLoader.

      Parameters:
      clazz - A reference to Class<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.