public final class SPIClassIterator<S> extends Object implements Iterator<Class<? extends S>>
ServiceLoader
but is guaranteed to
be bug-free regarding classpath order and does not instantiate or initialize
the classes found.Modifier and Type | Method and Description |
---|---|
static <S> SPIClassIterator<S> |
get(Class<S> clazz)
Creates a new SPI iterator to lookup services of type
clazz using
the same ClassLoader as the argument. |
static <S> SPIClassIterator<S> |
get(Class<S> clazz,
ClassLoader loader)
Creates a new SPI iterator to lookup services of type
clazz using the given classloader. |
boolean |
hasNext() |
static boolean |
isParentClassLoader(ClassLoader parent,
ClassLoader child)
Utility method to check if some class loader is a (grand-)parent of or the same as another one.
|
Class<? extends S> |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public static <S> SPIClassIterator<S> get(Class<S> clazz)
clazz
using
the same ClassLoader
as the argument.public static <S> SPIClassIterator<S> get(Class<S> clazz, ClassLoader loader)
clazz
using the given classloader.public static boolean isParentClassLoader(ClassLoader parent, ClassLoader child)
If caller's codesource doesn't have enough permissions to do the check, false
is returned
(this is fine, because if we get a SecurityException
it is for sure no parent).
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.