Class ReflectionUtils


  • public class ReflectionUtils
    extends java.lang.Object
    Author:
    Fabrizio Giudici
    • Constructor Detail

      • ReflectionUtils

        public ReflectionUtils()
    • Method Detail

      • forEachMethodInTopDownHierarchy

        public static void forEachMethodInTopDownHierarchy​(@Nonnull
                                                           java.lang.Object object,
                                                           @Nonnull
                                                           ReflectionUtils.MethodProcessor processor)
        Navigates the hierarchy of the given object, top down, and applies the ReflectionUtils.MethodProcessor to all the methods of each class, if not filtered out by the processor itself.
        Parameters:
        object - the object at the bottom of the hierarchy
        processor - the processor
      • forEachMethodInBottomUpHierarchy

        public static void forEachMethodInBottomUpHierarchy​(@Nonnull
                                                            java.lang.Object object,
                                                            @Nonnull
                                                            ReflectionUtils.MethodProcessor processor)
        Navigates the hierarchy of the given object, bottom up, and applies the ReflectionUtils.MethodProcessor to all the methods of each class, if not filtered out by the processor itself.
        Parameters:
        object - the object at the bottom of the hierarchy
        processor - the processor
      • containsAnnotation

        public static boolean containsAnnotation​(@Nonnull
                                                 java.lang.annotation.Annotation[] annotations,
                                                 @Nonnull
                                                 java.lang.Class<?> annotationClass)
        Checks whether an array of annotations contains an annotation of the given type.
        Parameters:
        annotations - the annotations to check
        annotationClass - the type of the required annotation
        Returns:
        true if the annotation is found