org.apache.lucene.analysis.util

## Class AnalysisSPILoader<S extends AbstractAnalysisFactory>

- java.lang.Object
- - org.apache.lucene.analysis.util.AnalysisSPILoader<S>

-     public final class AnalysisSPILoader<S extends AbstractAnalysisFactory>
      extends Object

  Helper class for loading named SPIs from classpath (e.g. Tokenizers, TokenStreams).
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnalysisSPILoader(Class<S> clazz)`
    `AnalysisSPILoader(Class<S> clazz, String[] suffixes)`
    `AnalysisSPILoader(Class<S> clazz, String[] suffixes, ClassLoader classloader)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<String>` | `availableServices()`
    `Class<? extends S>` | `lookupClass(String name)`
    `static <T extends AbstractAnalysisFactory> T` | `newFactoryClassInstance(Class<T> clazz, Map<String,String> args)` Creates a new instance of the given `AbstractAnalysisFactory` by invoking the constructor, passing the given argument map.
    `S` | `newInstance(String name, Map<String,String> args)`
    `void` | `reload(ClassLoader classloader)` Reloads the internal SPI list from the given `ClassLoader`.

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

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

- - ### Constructor Detail

    - #### AnalysisSPILoader

          public AnalysisSPILoader(Class<S> clazz)

    - #### AnalysisSPILoader

          public AnalysisSPILoader(Class<S> clazz,
                                   String[] suffixes)

    - #### AnalysisSPILoader

          public AnalysisSPILoader(Class<S> clazz,
                                   String[] suffixes,
                                   ClassLoader classloader)

  - ### Method Detail

    - #### reload

          public void reload(ClassLoader classloader)

      Reloads the internal SPI list from the given `ClassLoader`. Changes to the service list are visible after the method ends, all iterators (e.g., from `availableServices()`,...) stay consistent.

      NOTE: Only new service providers are added, existing ones are never removed or replaced.

      This method is expensive and should only be called for discovery of new service providers on the given classpath/classloader!

    - #### newInstance

          public S newInstance(String name,
                               Map<String,String> args)

    - #### lookupClass

          public Class<? extends S> lookupClass(String name)

    - #### availableServices

          public Set<String> availableServices()

    - #### newFactoryClassInstance

          public static <T extends AbstractAnalysisFactory> T newFactoryClassInstance(Class<T> clazz,
                                                                                      Map<String,String> args)

      Creates a new instance of the given `AbstractAnalysisFactory` by invoking the constructor, passing the given argument map.

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.