Class Reflections

java.lang.Object
org.zkoss.zk.ui.select.impl.Reflections

public class Reflections extends Object
A collection of reflection utilities.
Since:
6.0.0
Author:
simonpai
  • 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

      public static boolean isAppendableToCollection(Type type, Object object)
      Return true if field is of Collection type, and an object of type clazz can be added into the Collection.
    • isPassableToMethod

      public static boolean isPassableToMethod(Method method, Object... arguments)
      Return true if the given arguments can be passed as the arguments of the method.
    • setFieldValue

      public static void setFieldValue(Object bean, Field field, Object value)
      Set a value to a field of the object.
    • getFieldValue

      public static Object getFieldValue(Object bean, Field field)
      Get field value.
    • addToCollectionField

      public static void addToCollectionField(Object owner, Field field, Object item)
      Add the item to a collection field of an object.
    • invokeMethod

      public static void invokeMethod(Method method, Object bean, Object... arguments)
      Invoke a method reflexively.
    • getClass

      public static Class<?> getClass(Type type)
      Return the Class representing the given Type.