Package org.apache.nifi.util
Class ReflectionUtils
java.lang.Object
org.apache.nifi.util.ReflectionUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinvokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, Object... args) Invokes all methods on the given instance that have been annotated with the given Annotation.static booleanquietlyInvokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, Object... args) Invokes all methods on the given instance that have been annotated with the given Annotation.
-
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 ininstanceuses 1 or more parameters, those parameters must be specified by theargsparameter. However, if more arguments are supplied by theargsparameter than needed, the extra arguments will be ignored.- Parameters:
annotation- the annotation to look forinstance- to invoke a method ofargs- to supply in a method call- Throws:
InvocationTargetException- iteIllegalArgumentException- iaeIllegalAccessException- 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 ininstanceuses 1 or more parameters, those parameters must be specified by theargsparameter. However, if more arguments are supplied by theargsparameter than needed, the extra arguments will be ignored.- Parameters:
annotation- the annotation to look forinstance- to invoke a method ofargs- to supply in a method call- Returns:
trueif all appropriate methods were invoked and returned without throwing an Exception,falseif one of the methods threw an Exception or could not be invoked; iffalseis returned, an error will have been logged.
-