public class ReflectionUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
ReflectionUtils.Annotations |
| Modifier and Type | Field and Description |
|---|---|
private static Map<Class<?>,Map<ReflectionUtils.Annotations,List<Method>>> |
annotationCache |
private static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
private static Object[] |
buildUpdatedArgumentsList(boolean quietly,
Method method,
Class<?>[] annotations,
ComponentLog processLogger,
Object... args) |
private static List<Method> |
discoverMethodsWithAnnotations(Class<?> clazz,
Class<? extends Annotation>[] annotations) |
private static List<Method> |
findMethodsWithAnnotations(Class<?> clazz,
Class<? extends Annotation>[] annotationClasses) |
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.
|
private static boolean |
invokeMethodsWithAnnotations(boolean quietly,
ComponentLog logger,
Object instance,
Class<?> clazz,
Class<? extends Annotation>[] annotations,
Object... args) |
private static boolean |
invokeMethodsWithAnnotations(boolean quietly,
ComponentLog logger,
Object instance,
Class<? extends Annotation>[] annotations,
Object... args) |
static void |
invokeMethodsWithAnnotations(Class<? extends Annotation> preferredAnnotation,
Class<? extends Annotation> alternateAnnotation,
Object instance,
Object... args)
Invokes all methods on the given instance that have been annotated with the given preferredAnnotation and if no such method exists will invoke all methods on the given instance that have been
annotated with the given alternateAnnotation, if any exists.
|
private static boolean |
isAnnotationPresent(Method method,
Class<? extends Annotation> annotationClass) |
private static boolean |
isAnyAnnotationPresent(Method method,
Class<? extends Annotation>[] annotations) |
private static void |
logErrorMessage(String message,
ComponentLog processLogger,
Exception e) |
static boolean |
quietlyInvokeMethodsWithAnnotation(Class<? extends Annotation> annotation,
Object instance,
ComponentLog logger,
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.
|
static boolean |
quietlyInvokeMethodsWithAnnotations(Class<? extends Annotation> preferredAnnotation,
Class<? extends Annotation> alternateAnnotation,
Object instance,
ComponentLog logger,
Object... args)
Invokes all methods on the given instance that have been annotated with
the given preferredAnnotation and if no such method exists will invoke
all methods on the given instance that have been annotated with the given
alternateAnnotation, if any exists.
|
static boolean |
quietlyInvokeMethodsWithAnnotations(Class<? extends Annotation> preferredAnnotation,
Class<? extends Annotation> alternateAnnotation,
Object instance,
Object... args)
Invokes all methods on the given instance that have been annotated with the given preferredAnnotation and if no such method exists will invoke all methods on the given instance that have been
annotated with the given alternateAnnotation, if any exists.
|
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 - annotationinstance - instanceargs - argsInvocationTargetException - exIllegalArgumentException - exIllegalAccessException - expublic static void invokeMethodsWithAnnotations(Class<? extends Annotation> preferredAnnotation, Class<? extends Annotation> alternateAnnotation, 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.preferredAnnotation - preferredalternateAnnotation - alternateinstance - instanceargs - argsInvocationTargetException - exIllegalArgumentException - exIllegalAccessException - expublic 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 - annotationinstance - instanceargs - argstrue 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.public static boolean quietlyInvokeMethodsWithAnnotation(Class<? extends Annotation> annotation, Object instance, ComponentLog logger, 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 - annotationinstance - instancelogger - loggerargs - argstrue 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.public static boolean quietlyInvokeMethodsWithAnnotations(Class<? extends Annotation> preferredAnnotation, Class<? extends Annotation> alternateAnnotation, 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.preferredAnnotation - preferredalternateAnnotation - alternateinstance - instanceargs - argstrue 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.private static boolean invokeMethodsWithAnnotations(boolean quietly,
ComponentLog logger,
Object instance,
Class<? extends Annotation>[] annotations,
Object... args)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
private static boolean invokeMethodsWithAnnotations(boolean quietly,
ComponentLog logger,
Object instance,
Class<?> clazz,
Class<? extends Annotation>[] annotations,
Object... args)
throws IllegalAccessException,
IllegalArgumentException,
InvocationTargetException
private static List<Method> findMethodsWithAnnotations(Class<?> clazz, Class<? extends Annotation>[] annotationClasses)
private static List<Method> discoverMethodsWithAnnotations(Class<?> clazz, Class<? extends Annotation>[] annotations)
private static boolean isAnyAnnotationPresent(Method method, Class<? extends Annotation>[] annotations)
private static boolean isAnnotationPresent(Method method, Class<? extends Annotation> annotationClass)
private static Object[] buildUpdatedArgumentsList(boolean quietly, Method method, Class<?>[] annotations, ComponentLog processLogger, Object... args)
private static void logErrorMessage(String message, ComponentLog processLogger, Exception e)
public static boolean quietlyInvokeMethodsWithAnnotations(Class<? extends Annotation> preferredAnnotation, Class<? extends Annotation> alternateAnnotation, Object instance, ComponentLog logger, 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.preferredAnnotation - preferredalternateAnnotation - alternateinstance - instancelogger - the ComponentLog to use for logging any errors. If null, will
use own logger, but that will not generate bulletins or easily
tie to the Processor's log messages.args - argstrue 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.