public final class SPIClassIterator<S>
extends java.lang.Object
implements java.util.Iterator<java.lang.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(java.lang.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(java.lang.Class<S> clazz,
java.lang.ClassLoader loader)
Creates a new SPI iterator to lookup services of type
clazz using the given classloader. |
boolean |
hasNext() |
static boolean |
isParentClassLoader(java.lang.ClassLoader parent,
java.lang.ClassLoader child)
Utility method to check if some class loader is a (grand-)parent of or the same as another one.
|
java.lang.Class<? extends S> |
next() |
void |
remove() |
public static <S> SPIClassIterator<S> get(java.lang.Class<S> clazz)
clazz
using
the same ClassLoader
as the argument.public static <S> SPIClassIterator<S> get(java.lang.Class<S> clazz, java.lang.ClassLoader loader)
clazz
using the given classloader.public static boolean isParentClassLoader(java.lang.ClassLoader parent, java.lang.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).
public boolean hasNext()
hasNext
in interface java.util.Iterator<java.lang.Class<? extends S>>
public java.lang.Class<? extends S> next()
next
in interface java.util.Iterator<java.lang.Class<? extends S>>
public void remove()
remove
in interface java.util.Iterator<java.lang.Class<? extends S>>
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.