Package space.arim.dazzleconf.reflect
Interface MethodMirror.Invoker
- Enclosing interface:
MethodMirror
public static interface MethodMirror.Invoker
A wrapper for an instance whose methods can be called, as long as those methods conform to a certain
enclosing type.
-
Method Summary
Modifier and TypeMethodDescription@Nullable ObjectinvokeMethod(@NonNull MethodId methodId, @Nullable Object @Nullable ... arguments) Invokes a method and gets the return value.
-
Method Details
-
invokeMethod
@Nullable Object invokeMethod(@NonNull MethodId methodId, @Nullable Object @Nullable ... arguments) throws InvocationTargetException Invokes a method and gets the return value.The method must be taken from
MethodMirror.TypeWalker.getViableMethods(), meaning it must be accessible and located in the type thisTypeWalkeris made for. This function is permitted to assume this precondition and may behave unexpectedly if it is not met.- Parameters:
methodId- the method to callarguments- method arguments. The array may benullfor none, and the arguments may be boxed primitive objects to represent primitive values.- Returns:
- the return value, boxing primitives if necessary
- Throws:
InvocationTargetException- if the method threw a throwable, it is wrapped in this exception
-