Package opennlp.tools.util.ext

## 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 Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static <T> T` | `instantiateExtension​(Class<T> clazz, String extensionClassName)` | Instantiates a user provided extension to OpenNLP.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

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