@ThreadSafe
public final class MethodExecutor
extends java.lang.Object
| Constructor and Description |
|---|
MethodExecutor() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.reflect.Method |
findDeclaredAnnotatedMethod(@NotNull java.lang.Object obj,
@NotNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.lang.Class<?>... expectedArgumentTypes)
Finds a declared method on the instance or it's parents that has an annotation and optional parameters.
|
java.util.List<java.lang.reflect.Method> |
getDeclaredMethodsIncludingSuperClasses(@NotNull java.lang.Class<?> clasz,
java.lang.Class<?>... stopParents)
Returns a list of declared methods from classes and super classes.
|
<T> T |
invoke(@NotNull java.lang.reflect.Method method,
@NotNull java.lang.Object target,
java.lang.Object... args)
Invokes a method with any number of arguments.
|
<T> T |
invokeDeclaredAnnotatedMethod(@NotNull java.lang.Object obj,
@NotNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.lang.Class<?>[] argumentTypes,
java.lang.Object[] arguments)
Finds a declared method that has an annotation and optional parameters.
|
boolean |
same(java.lang.Class<?>[] expected,
java.lang.Class<?>[] actual)
Verifies if both arrays have the same length and types.
|
public final <T> T invokeDeclaredAnnotatedMethod(@NotNull
@NotNull java.lang.Object obj,
@NotNull
@NotNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.lang.Class<?>[] argumentTypes,
java.lang.Object[] arguments)
T - Type of the return value.obj - Object to inspect.annotationType - Expected annotation type.argumentTypes - Expected argument types, empty array or null.arguments - Arguments, empty array or null. Must be the same size as 'argumentTypes'.null.public final java.lang.reflect.Method findDeclaredAnnotatedMethod(@NotNull
@NotNull java.lang.Object obj,
@NotNull
@NotNull java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.lang.Class<?>... expectedArgumentTypes)
obj - Object to inspect.annotationType - Expected annotation type.expectedArgumentTypes - Expected argument types, empty array or null.null if any of the expected parameters does not match.public final java.util.List<java.lang.reflect.Method> getDeclaredMethodsIncludingSuperClasses(@NotNull
@NotNull java.lang.Class<?> clasz,
@NotNull
java.lang.Class<?>... stopParents)
clasz - Class to inspect.stopParents - Parent classes to stop inspection or null to stop at Object.public final <T> T invoke(@NotNull
@NotNull java.lang.reflect.Method method,
@NotNull
@NotNull java.lang.Object target,
java.lang.Object... args)
T - Type of the return value.method - Method to call.target - Object that contains the method.args - Arguments, empty array or null.null.public final boolean same(java.lang.Class<?>[] expected,
java.lang.Class<?>[] actual)
expected - Expected types, empty array or null.actual - Actual types, empty array or null.Copyright © 2019 fuin.org (Germany). All Rights Reserved.