public class ReflectionUtils extends Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
ReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
invokeMethodsWithAnnotation(Class<? extends Annotation> annotation,
Object instance,
Object... args)
Invokes all methods on the given instance that have been annotated with
the given Annotation.
|
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.
|
public static void invokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
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.annotation
- the annotation to look forinstance
- to invoke a method ofargs
- to supply in a method callInvocationTargetException
- iteIllegalArgumentException
- iaeIllegalAccessException
- if not allowed to invoke that methodpublic static boolean quietlyInvokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, Object... args)
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.annotation
- the annotation to look forinstance
- to invoke a method ofargs
- to supply in a method calltrue
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.Copyright © 2021 Apache NiFi Project. All rights reserved.