Module org.apache.lucene.core
Package org.apache.lucene.util
Class NamedSPILoader<S extends NamedSPILoader.NamedSPI>
java.lang.Object
org.apache.lucene.util.NamedSPILoader<S>
- All Implemented Interfaces:
Iterable<S>
public final class NamedSPILoader<S extends NamedSPILoader.NamedSPI>
extends Object
implements Iterable<S>
Helper class for loading named SPIs from classpath (e.g. Codec, PostingsFormat).
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNamedSPILoader(Class<S> clazz) NamedSPILoader(Class<S> clazz, ClassLoader classloader) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckServiceName(String name) Validates that a service name meets the requirements ofNamedSPILoader.NamedSPIprivate static booleanisLetterOrDigit(char c) Checks whether a character is a letter or digit (ascii) which are defined in the spec.iterator()voidreload(ClassLoader classloader) Reloads the internal SPI list from the givenClassLoader.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
services
-
clazz
-
-
Constructor Details
-
NamedSPILoader
-
NamedSPILoader
-
-
Method Details
-
reload
Reloads the internal SPI list from the givenClassLoader. Changes to the service list are visible after the method ends, all iterators (iterator(),...) 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!
-
checkServiceName
Validates that a service name meets the requirements ofNamedSPILoader.NamedSPI -
isLetterOrDigit
private static boolean isLetterOrDigit(char c) Checks whether a character is a letter or digit (ascii) which are defined in the spec. -
lookup
-
availableServices
-
iterator
- Specified by:
iteratorin interfaceIterable<S extends NamedSPILoader.NamedSPI>
-