All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fest.reflect.method.package.html Maven / Gradle / Ivy

The newest version!







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 {@link org.fest.reflect.core.Reflection org.fest.reflect.core.Reflection}.

Here are some examples:

   // import static {@link org.fest.reflect.core.Reflection org.fest.reflect.core.Reflection}.*;

   // Equivalent to call 'person.setName("Luke")'
   {@link org.fest.reflect.core.Reflection#method(String) method}("setName").{@link org.fest.reflect.method.MethodName#withParameterTypes(Class...) withParameterTypes}(String.class)
                    .{@link org.fest.reflect.method.MethodParameterTypes#in(Object) in}(person)
                    .{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}("Luke");
 
   // Equivalent to call 'person.concentrate()'
   {@link org.fest.reflect.core.Reflection#method(String) method}("concentrate").{@link org.fest.reflect.method.MethodName#in(Object) in}(person).{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}();
   
   // Equivalent to call 'person.getName()'
   String name = {@link org.fest.reflect.core.Reflection#method(String) method}("getName").{@link org.fest.reflect.method.MethodName#withReturnType(Class) withReturnType}(String.class)
                                  .{@link org.fest.reflect.method.MethodReturnType#in(Object) in}(person)
                                  .{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}();   

   // Equivalent to call 'Jedi.class.setCommonPower("Jump")'
   {@link org.fest.reflect.core.Reflection#staticMethod(String) staticMethod}("setCommonPower").{@link org.fest.reflect.method.StaticMethodName#withParameterTypes(Class...) withParameterTypes}(String.class)
                                 .{@link org.fest.reflect.method.StaticMethodParameterTypes#in(Class) in}(Jedi.class)
                                 .{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}("Jump");

   // Equivalent to call 'Jedi.class.addPadawan()'
   {@link org.fest.reflect.core.Reflection#staticMethod(String) staticMethod}("addPadawan").{@link org.fest.reflect.method.StaticMethodName#in(Class) in}(Jedi.class).{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}();

   // Equivalent to call 'Jedi.class.commonPowerCount()'
   String name = {@link org.fest.reflect.core.Reflection#staticMethod(String) staticMethod}("commonPowerCount").{@link org.fest.reflect.method.StaticMethodName#withReturnType(Class) withReturnType}(String.class)
                                                 .{@link org.fest.reflect.method.StaticMethodReturnType#in(Class) in}(Jedi.class)
                                                 .{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}();





© 2015 - 2024 Weber Informatics LLC | Privacy Policy