Class ReflectionUtils

java.lang.Object
org.apache.nifi.util.ReflectionUtils

public class ReflectionUtils extends Object
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

    • ReflectionUtils

      public ReflectionUtils()
  • Method Details

    • invokeMethodsWithAnnotation

      public static void invokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
      Invokes all methods on the given instance that have been annotated with the given Annotation. If the signature of the method that is defined in instance uses 1 or more parameters, those parameters must be specified by the args parameter. However, if more arguments are supplied by the args parameter than needed, the extra arguments will be ignored.
      Parameters:
      annotation - the annotation to look for
      instance - to invoke a method of
      args - to supply in a method call
      Throws:
      InvocationTargetException - ite
      IllegalArgumentException - iae
      IllegalAccessException - if not allowed to invoke that method
    • quietlyInvokeMethodsWithAnnotation

      public static boolean quietlyInvokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, Object... args)
      Invokes all methods on the given instance that have been annotated with the given Annotation. If the signature of the method that is defined in instance uses 1 or more parameters, those parameters must be specified by the args parameter. However, if more arguments are supplied by the args parameter than needed, the extra arguments will be ignored.
      Parameters:
      annotation - the annotation to look for
      instance - to invoke a method of
      args - to supply in a method call
      Returns:
      true if all appropriate methods were invoked and returned without throwing an Exception, false if one of the methods threw an Exception or could not be invoked; if false is returned, an error will have been logged.