|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.reflect.constructor.Invoker<T>
T
- the class in which the constructor is declared.
The following is an example of proper usage of the classes in this package:
// Equivalent to call 'new Person()' Person p =constructor
().in
(Person.class).newInstance
(); // Equivalent to call 'new Person("Yoda")' Person p =constructor
().withParameterTypes
(String.class).in
(Person.class).newInstance
("Yoda");
public final class Invoker<T>
Understands the invocation of a constructor via Java Reflection.
Method Summary | ||
---|---|---|
Constructor<T> |
info()
Returns the "real" constructor managed by this class. |
|
T |
newInstance(Object... args)
Creates a new instance of T by calling a constructor with the given arguments. |
|
static
|
newInvoker(Class<T> target,
Class<?>... parameterTypes)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> Invoker<T> newInvoker(Class<T> target, Class<?>... parameterTypes)
public T newInstance(Object... args)
T
by calling a constructor with the given arguments.
args
- the arguments to pass to the constructor (can be zero or more).
T
.
ReflectionError
- if a new instance cannot be created.public Constructor<T> info()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |