java.lang.Object
it.tidalwave.messagebus.spi.ReflectionUtils
Utilities for navigating, by means of reflection, the methods declared in the classes of the hierarchy of an object.
- Author:
- Fabrizio Giudici
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA processor of the methods of a hierarchy of classes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsAnnotation(Annotation[] annotations, Class<?> annotationClass) Checks whether an array of annotations contains an annotation of the given type.static voidforEachMethodInBottomUpHierarchy(Object object, ReflectionUtils.MethodProcessor processor) Navigates the hierarchy of the given object, bottom up (that is, starting from the class of the object), and applies theReflectionUtils.MethodProcessorto all the methods of each class, if not filtered out by the processor itself.static voidforEachMethodInTopDownHierarchy(Object object, ReflectionUtils.MethodProcessor processor) Navigates the hierarchy of the given object, top down (that is, starting fromObject), and applies theReflectionUtils.MethodProcessorto all the methods of each class, if not filtered out by the processor itself.
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
forEachMethodInTopDownHierarchy
public static void forEachMethodInTopDownHierarchy(@Nonnull Object object, @Nonnull ReflectionUtils.MethodProcessor processor) Navigates the hierarchy of the given object, top down (that is, starting fromObject), and applies theReflectionUtils.MethodProcessorto all the methods of each class, if not filtered out by the processor itself.- Parameters:
object- the object at the bottom of the hierarchyprocessor- the processor
-
forEachMethodInBottomUpHierarchy
public static void forEachMethodInBottomUpHierarchy(@Nonnull Object object, @Nonnull ReflectionUtils.MethodProcessor processor) Navigates the hierarchy of the given object, bottom up (that is, starting from the class of the object), and applies theReflectionUtils.MethodProcessorto all the methods of each class, if not filtered out by the processor itself.- Parameters:
object- the object at the bottom of the hierarchyprocessor- the processor
-
containsAnnotation
public static boolean containsAnnotation(@Nonnull Annotation[] annotations, @Nonnull Class<?> annotationClass) Checks whether an array of annotations contains an annotation of the given type.- Parameters:
annotations- the annotations to checkannotationClass- the type of the required annotation- Returns:
- true if the annotation is found
-