Class ReflectionHelper


  • public class ReflectionHelper
    extends Object
    Utility class with useful methods to work with reflections
    Author:
    andrzej
    • Constructor Detail

      • ReflectionHelper

        public ReflectionHelper()
    • Method Detail

      • classMatchesClassWithParameters

        public static boolean classMatchesClassWithParameters​(Class clazz,
                                                              Class requiredType,
                                                              Type[] requiredTypeParams)
      • classMatchesType

        public static boolean classMatchesType​(Class clazz,
                                               Type required)
      • collectAnnotatedMethods

        public static <A extends Annotation,​T> Collection<T> collectAnnotatedMethods​(Object consumer,
                                                                                           Class<A> annotationCls,
                                                                                           ReflectionHelper.Handler<A,​T> handler)
        This method collects every method of consumer class annotated with passed annotation and for each of them executes implementation of Handler.
      • getCollectionParamter

        public static Type getCollectionParamter​(Type genericType,
                                                 Class clazz)
      • getItemClassOfGenericCollection

        public static Class<?> getItemClassOfGenericCollection​(Field f)