See: Description
Class | Description |
---|---|
Invoker<T> |
Understands the use of reflection to access a method from an object.
|
MethodName |
Understands the name of a method to invoke using Java Reflection.
|
MethodParameterTypes<T> |
Understands the parameter types of the method to invoke.
|
MethodReturnType<T> |
Understands the return type of the method to invoke.
|
MethodReturnTypeRef<T> |
Understands the return type reference of the method to invoke.
|
StaticMethodName |
Understands the name of a static method to invoke using Java Reflection.
|
StaticMethodParameterTypes<T> |
Understands the parameter types of the static method to invoke.
|
StaticMethodReturnType<T> |
Understands the return type of the static method to invoke.
|
StaticMethodReturnTypeRef<T> |
Understands the return type of the static method to invoke.
|
Provides a "fluent" API for method invocation via the Java Reflection API.
Note: Classes in this package are not intended to be used directly. To use them, you need to use the
class
.
org.fest.reflect.core.Reflection
Here are some examples:
// import staticorg.fest.reflect.core.Reflection
.*; // Equivalent to call 'person.setName("Luke")'method
("setName").withParameterTypes
(String.class) .in
(person) .invoke
("Luke"); // Equivalent to call 'person.concentrate()'method
("concentrate").in
(person).invoke
(); // Equivalent to call 'person.getName()' String name =method
("getName").withReturnType
(String.class) .in
(person) .invoke
(); // Equivalent to call 'Jedi.class.setCommonPower("Jump")'staticMethod
("setCommonPower").withParameterTypes
(String.class) .in
(Jedi.class) .invoke
("Jump"); // Equivalent to call 'Jedi.class.addPadawan()'staticMethod
("addPadawan").in
(Jedi.class).invoke
(); // Equivalent to call 'Jedi.class.commonPowerCount()' String name =staticMethod
("commonPowerCount").withReturnType
(String.class) .in
(Jedi.class) .invoke
();
Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.