|
Class Summary |
| ConstructorInvoker<T> |
Contructor invocation via reflection |
| ConstructorParameterTypes |
Parameter types for the constructor to invoke. |
| ConstructorReflection |
Constructor Reflection
Usage example:
// Equivalent to call 'new MyObj()'
MyObj p = Reflection.constructor().in(MyObj.class).newInstance();
// Equivalent to call 'new MyObj("myStrParam")'
Person p = Reflection.constructor().withParameterTypes(String.class).in(MyObj.class).newInstance("myStrParam");
|
| FieldInvoker<T> |
Object's field access using reflection |
| FieldReflection |
Reflection for a class Field
Usage example:
// Retrieves the value of the field "name"
String name = Reflection.field("name").ofType(String.class).in(person).get}();
// Sets the value of the field "name" to "Yoda"
Reflection.field("name").ofType(String.class).in(person).set("Yoda");
// Retrieves the value of the field "powers"
List powers = Reflection.field("powers").ofType(new TypeRef>() {}).in(jedi).get();
// Sets the value of the field "powers"
List powers = new ArrayList
powers.add("heal");
Reflection.field("powers").ofType(new TypeRef >() {}).in(jedi).set(powers);
|
| FieldTypes |
|
| FieldTypes.FieldType<T> |
Encapsulates a Field type |
| FieldTypes.FieldTypeGenerics<T> |
Encapsulates a Field type suporting generics |
| FluentReflection |
Entry point for the fluent api. |
| MethodInvoker<T> |
Method invocation using reflection |
| MethodParameterTypes<T> |
Encapsulates a method parameter type |
| MethodReflection |
Method Reflection
Usage example:
// Equivalent to call 'person.setName("Luke")'
Reflection.method("setName").withParameterTypes(String.class).in(person).invoke("Luke");
// Equivalent to call 'person.concentrate()'
Reflection.method("concentrate").in(person).invoke();
// Equivalent to call 'person.getName()'
String name = Reflection.method("getName").withReturnType(String.class).in(person).invoke();
// Equivalent to call 'jedi.getPowers()'
List powers = Reflection.method("getPowers").withReturnType(new TypeRef>() {}).in(person).invoke();
|
| MethodReturnTypes |
|
| MethodReturnTypes.MethodReturnType<T> |
Return type of the method to invoke. |
| MethodReturnTypes.MethodReturnTypeGenerics<T> |
Return type of the method to invoke using generics |
| PropertyInvoker<T> |
Reflection to access a property from a JavaBean. |
| PropertyReflection |
Bean Introspection
Usage example:
// Retrieves the value of the property "name"
String name = Reflection.property("name").ofType(String.class).in(person).get();
// Sets the value of the property "name" to "Yoda"
Reflection.property("name").ofType(String.class).in(person).set("Yoda");
// Retrieves the value of the property "powers"
List powers = Reflection.property("powers").ofType(new TypeRef>() {}).in(jedi).get();
// Sets the value of the property "powers"
List powers = new ArrayList();
powers.add("heal");
Reflection.property("powers").ofType(new TypeRef>() {}).in(jedi).set(powers);
|
| PropertyTypes |
|
| PropertyTypes.PropertyType<T> |
Understands the type of a property to access using Bean Instrospection. |
| PropertyTypes.PropertyTypeGenerics<T> |
Understands the type of a property to access using Bean Instrospection. |
| StaticFieldReflection |
Static field reflection
Usage example:
// Retrieves the value of the static field "count"
int count = Reflection.staticField("count").ofType(int.class).in(Person.class).get();
// Sets the value of the static field "count" to 3
Reflection.staticField("count").ofType(int.class).in(Person.class).set(3);
// Retrieves the value of the static field "commonPowers"
List commmonPowers = Reflection.staticField("commonPowers").ofType(new TypeRef>() {}).in(Jedi.class).get();
// Sets the value of the static field "commonPowers"
List commonPowers = new ArrayList();
commonPowers.add("jump");
Reflection.staticField("commonPowers").ofType(new TypeRef>() {}).in(Jedi.class).set(commonPowers);
|
| StaticFieldTypes |
|
| StaticFieldTypes.StaticFieldType<T> |
Static field to access using Java Reflection. |
| StaticFieldTypes.StaticFieldTypeGenerics<T> |
Static field to access using Java Reflection. |
| StaticInnerClassInvoker |
Understands how to obtain a reference to a static inner class. |
| StaticInnerClassReflection |
Static Inner class
Let's assume we have the class Jedi, which contains two static inner classes: Master and Padawan. |
| StaticMethodParameterTypes<T> |
Parameter types of the static method to invoke. |
| StaticMethodReflection |
Static methoc reflection. |
| StaticMethodReturnTypes |
|
| StaticMethodReturnTypes.StaticMethodReturnType<T> |
Return type of the static method to invoke. |
| StaticMethodReturnTypes.StaticMethodReturnTypeGenerics<T> |
Return type of the static method to invoke. |
| TypeInvoker |
Class Loading using a specific ClassLoader. |
| TypeReflection |
Class Loading. |