|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectr01f.reflection.fluent.TypeReflection
public final class TypeReflection
Class Loading. Usage example:
// Loads the class 'org.republic.Jedi'
Class> jediType = Reflection.type("org.republic.Jedi").load();
// Loads the class 'org.republic.Jedi' as 'org.republic.Person' (Jedi extends Person)
Class jediType = Reflection.type("org.republic.Jedi").loadAs(Person.class);
// Loads the class 'org.republic.Jedi' using a custom class loader
Class> jediType = Reflection.type("org.republic.Jedi").withClassLoader(myClassLoader).load();
| Field Summary | |
|---|---|
private java.lang.String |
_className
|
| Constructor Summary | |
|---|---|
private |
TypeReflection(java.lang.String className)
Constructor |
| Method Summary | ||
|---|---|---|
java.lang.Class<?> |
load()
Loads the class with the name specified in this type, using this class' ClassLoader. |
|
|
loadAs(java.lang.Class<T> type)
Loads the class with the name specified in this type, as the given type, using this class' ClassLoader. |
|
(package private) static TypeReflection |
startTypeAccess(java.lang.String className)
Creates a new : the starting point of the fluent interface for loading classes dynamically. |
|
private java.lang.ClassLoader |
thisClassLoader()
Obtiene el classLoader local |
|
TypeInvoker |
withClassLoader(java.lang.ClassLoader classLoader)
Specifies the to use to load the class. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final java.lang.String _className
| Constructor Detail |
|---|
private TypeReflection(java.lang.String className)
className - | Method Detail |
|---|
static TypeReflection startTypeAccess(java.lang.String className)
TypeReflection: the starting point of the fluent interface for loading classes dynamically.
className - the name of the class to load.
Type.
java.lang.NullPointerException - if the given name is null.
java.lang.IllegalArgumentException - if the given name is empty.public TypeInvoker withClassLoader(java.lang.ClassLoader classLoader)
ClassLoader to use to load the class.
Example:
Class> jediType = Reflection.type("org.republic.Jedi").withClassLoader(myClassLoader).load();
classLoader - the given ClassLoader.
ClassLoader.
java.lang.NullPointerException - if the given ClassLoader is null.public java.lang.Class<?> load()
ClassLoader.
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:
ClassjediType = Reflection.type("org.republic.Jedi").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.private java.lang.ClassLoader thisClassLoader()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||