Package org.zkoss.zk.ui.select.impl
Class Reflections
java.lang.Object
org.zkoss.zk.ui.select.impl.Reflections
A collection of reflection utilities.
- Since:
- 6.0.0
- Author:
- simonpai
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceReflections.FieldRunner<A extends Annotation>static interfaceReflections.MethodRunner<A extends Annotation> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToCollectionField(Object owner, Field field, Object item) Add the item to a collection field of an object.static <A extends Annotation>
voidforFields(Class<?> clazz, Class<A> annotationClass, Reflections.FieldRunner<A> runner) Traverse through all fields with a certain annotation in a class and it super classes.static <A extends Annotation>
voidforMethods(Class<?> clazz, Class<A> annotationClass, Reflections.MethodRunner<A> runner) Traverse through all methods with a certain annotation in a class, including ones inherited from its super class.static Class<?>Return the Class representing the given Type.static ObjectgetFieldValue(Object bean, Field field) Get field value.static voidinvokeMethod(Method method, Object bean, Object... arguments) Invoke a method reflexively.static booleanisAppendableToCollection(Type type, Object object) Return true if field is of Collection type, and an object of type clazz can be added into the Collection.static booleanisPassableToMethod(Method method, Object... arguments) Return true if the given arguments can be passed as the arguments of the method.static voidsetFieldValue(Object bean, Field field, Object value) Set a value to a field of the object.
-
Constructor Details
-
Reflections
public Reflections()
-
-
Method Details
-
forFields
public static <A extends Annotation> void forFields(Class<?> clazz, Class<A> annotationClass, Reflections.FieldRunner<A> runner) Traverse through all fields with a certain annotation in a class and it super classes. Subclass first.All the fields with the same name will be scanned too. (since 6.5.1), before 6.5.1 release, only the subclass will be scanned.
-
forMethods
public static <A extends Annotation> void forMethods(Class<?> clazz, Class<A> annotationClass, Reflections.MethodRunner<A> runner) Traverse through all methods with a certain annotation in a class, including ones inherited from its super class. -
isAppendableToCollection
Return true if field is of Collection type, and an object of type clazz can be added into the Collection. -
isPassableToMethod
Return true if the given arguments can be passed as the arguments of the method. -
setFieldValue
Set a value to a field of the object. -
getFieldValue
Get field value. -
addToCollectionField
Add the item to a collection field of an object. -
invokeMethod
Invoke a method reflexively. -
getClass
Return the Class representing the given Type.
-