| 1 |
<?xml version="1.0" encoding="UTF-8" ?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 |
<head> |
| 5 |
<!-- |
| 6 |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
| 7 |
in compliance with the License. You may obtain a copy of the License at |
| 8 |
|
| 9 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
|
| 11 |
Unless required by applicable law or agreed to in writing, software distributed under the License |
| 12 |
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 13 |
or implied. See the License for the specific language governing permissions and limitations under |
| 14 |
the License. |
| 15 |
|
| 16 |
Copyright @2007-2009 the original author or authors. |
| 17 |
--> |
| 18 |
</head> |
| 19 |
<body bgcolor="white"> |
| 20 |
<p> |
| 21 |
Provides a "fluent" API for |
| 22 |
method invocation via the Java Reflection API. |
| 23 |
</p> |
| 24 |
<p> |
| 25 |
<strong>Note:</strong> Classes in this package are not intended to be used directly. To use them, you need to use the |
| 26 |
class <code>{@link org.fest.reflect.core.Reflection org.fest.reflect.core.Reflection}</code>. |
| 27 |
</p> |
| 28 |
<p> |
| 29 |
Here are some examples: |
| 30 |
<pre> |
| 31 |
// import static {@link org.fest.reflect.core.Reflection org.fest.reflect.core.Reflection}.*; |
| 32 |
|
| 33 |
// Equivalent to call 'person.setName("Luke")' |
| 34 |
{@link org.fest.reflect.core.Reflection#method(String) method}("setName").{@link org.fest.reflect.method.MethodName#withParameterTypes(Class...) withParameterTypes}(String.class) |
| 35 |
.{@link org.fest.reflect.method.MethodParameterTypes#in(Object) in}(person) |
| 36 |
.{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}("Luke"); |
| 37 |
|
| 38 |
// Equivalent to call 'person.concentrate()' |
| 39 |
{@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}(); |
| 40 |
|
| 41 |
// Equivalent to call 'person.getName()' |
| 42 |
String name = {@link org.fest.reflect.core.Reflection#method(String) method}("getName").{@link org.fest.reflect.method.MethodName#withReturnType(Class) withReturnType}(String.class) |
| 43 |
.{@link org.fest.reflect.method.MethodReturnType#in(Object) in}(person) |
| 44 |
.{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}(); |
| 45 |
|
| 46 |
// Equivalent to call 'Jedi.class.setCommonPower("Jump")' |
| 47 |
{@link org.fest.reflect.core.Reflection#staticMethod(String) staticMethod}("setCommonPower").{@link org.fest.reflect.method.StaticMethodName#withParameterTypes(Class...) withParameterTypes}(String.class) |
| 48 |
.{@link org.fest.reflect.method.StaticMethodParameterTypes#in(Class) in}(Jedi.class) |
| 49 |
.{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}("Jump"); |
| 50 |
|
| 51 |
// Equivalent to call 'Jedi.class.addPadawan()' |
| 52 |
{@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}(); |
| 53 |
|
| 54 |
// Equivalent to call 'Jedi.class.commonPowerCount()' |
| 55 |
String name = {@link org.fest.reflect.core.Reflection#staticMethod(String) staticMethod}("commonPowerCount").{@link org.fest.reflect.method.StaticMethodName#withReturnType(Class) withReturnType}(String.class) |
| 56 |
.{@link org.fest.reflect.method.StaticMethodReturnType#in(Class) in}(Jedi.class) |
| 57 |
.{@link org.fest.reflect.method.Invoker#invoke(Object...) invoke}(); |
| 58 |
</pre> |
| 59 |
</p> |
| 60 |
</body> |
| 61 |
</html> |