public final class TypeLoader
extends java.lang.Object
ClassLoader.| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<?> |
load()
Loads the class with the name specified in this type, using this class'
ClassLoader. |
<T> java.lang.Class<? extends T> |
loadAs(java.lang.Class<T> type)
Loads the class with the name specified in this type, as the given type, using this class'
ClassLoader. |
public java.lang.Class<?> load()
ClassLoader.
Example:
Class<?> type =type("org.republic.Jedi").withClassLoader(myClassLoader).load();
ReflectionError - wrapping any error that occurred during class loading.public <T> java.lang.Class<? extends T> loadAs(java.lang.Class<T> type)
ClassLoader.
The following example shows how to use this method. Let's assume that we have the class Jedi that extends the
class Person:
Class<Person> type =type("org.republic.Jedi").withClassLoader(myClassLoader).loadAs(Person.class);
T - the generic type of the type.type - the given type.java.lang.NullPointerException - if the given type is null.ReflectionError - wrapping any error that occurred during class loading.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.