public static class DynClasses.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
<S> java.lang.Class<? extends S> |
build()
Returns the first implementation or throws RuntimeException if one was
not found.
|
<S> java.lang.Class<? extends S> |
buildChecked()
Returns the first implementation or throws ClassNotFoundException if
one was not found.
|
DynClasses.Builder |
impl(java.lang.String className)
Checks for an implementation of the class by name.
|
DynClasses.Builder |
loader(java.lang.ClassLoader newLoader)
Set the
ClassLoader used to lookup classes by name. |
DynClasses.Builder |
orNull()
Instructs this builder to return null if no class is found, rather than
throwing an Exception.
|
public DynClasses.Builder loader(java.lang.ClassLoader newLoader)
ClassLoader
used to lookup classes by name.
If not set, the current thread's ClassLoader is used.
newLoader
- a ClassLoaderpublic DynClasses.Builder impl(java.lang.String className)
className
- name of a classpublic DynClasses.Builder orNull()
public <S> java.lang.Class<? extends S> buildChecked() throws java.lang.ClassNotFoundException
S
- Java superclassClass
for the first implementation foundjava.lang.ClassNotFoundException
- if no implementation was foundpublic <S> java.lang.Class<? extends S> build()
S
- Java superclassClass
for the first implementation foundjava.lang.RuntimeException
- if no implementation was found