public abstract class ClassSource
extends java.lang.Object
Constructor and Description |
---|
ClassSource() |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
append(java.lang.String a,
java.lang.String b)
Append to canonical names together.
|
static ClassSource |
fromClassLoader()
Construct a class source from the default class loader.
|
static ClassSource |
fromClassLoader(java.lang.ClassLoader loader)
Construct a class source from the given class loader.
|
static ClassSource |
fromMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
Construct a class source from a mapping of canonical names and the corresponding classes.
|
static ClassSource |
fromPackage(java.lang.String packageName)
Construct a class source from the default class loader and package.
|
abstract java.lang.Class<?> |
loadClass(java.lang.String canonicalName)
Retrieve a class by name.
|
ClassSource |
retry(ClassSource other)
Retrieve a class source that will retry failed lookups in the given source.
|
ClassSource |
usingPackage(java.lang.String packageName)
Retrieve a class source that prepends a specific package name to every lookup.
|
public static ClassSource fromClassLoader()
public static ClassSource fromPackage(java.lang.String packageName)
packageName
- - the package that is prepended to every lookup.public static ClassSource fromClassLoader(java.lang.ClassLoader loader)
loader
- - the class loader.public static ClassSource fromMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
map
- - map of class names and classes.public ClassSource retry(ClassSource other)
other
- - the other class source.public ClassSource usingPackage(java.lang.String packageName)
packageName
- - the package name to prepend.protected static java.lang.String append(java.lang.String a, java.lang.String b)
a
- - the name to the left.b
- - the name to the right.public abstract java.lang.Class<?> loadClass(java.lang.String canonicalName) throws java.lang.ClassNotFoundException
canonicalName
- - the full canonical name of the class.java.lang.ClassNotFoundException
- If the class could not be found.