Package org.fest.reflect.method
package org.fest.reflect.method
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
();
-
ClassesClassDescriptionInvoker<T>Understands the use of reflection to access a method from an object.Understands the name of a method to invoke using Java Reflection.Understands the parameter types of the method to invoke.Understands the return type of the method to invoke.Understands the return type reference of the method to invoke.Understands the name of a static method to invoke using Java Reflection.Understands the parameter types of the static method to invoke.Understands the return type of the static method to invoke.Understands the return type of the static method to invoke.