Class FastInvoke
java.lang.Object
me.ahoo.wow.infra.accessor.method.FastInvoke
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tinvoke target object methodstatic <T> TnewInstance(Constructor<T> constructor, Object[] args) create instancestatic <T> TsafeInvoke(Method method, Object target, Object[] args) safe invoke target object methodstatic <T> TsafeNewInstance(Constructor<T> constructor, Object[] args) safe create instance
-
Method Details
-
invoke
public static <T> T invoke(@NotNull Method method, Object target, Object[] args) throws InvocationTargetException, IllegalAccessException invoke target object method- Type Parameters:
T- result type- Parameters:
method- methodtarget- targetargs- args- Returns:
- result
- Throws:
InvocationTargetException- InvocationTargetExceptionIllegalAccessException- IllegalAccessException
-
safeInvoke
public static <T> T safeInvoke(@NotNull Method method, Object target, Object[] args) throws Throwable safe invoke target object method- Type Parameters:
T- result type- Parameters:
method- methodtarget- targetargs- args- Returns:
- result
- Throws:
InvocationTargetException- InvocationTargetExceptionIllegalAccessException- IllegalAccessExceptionThrowable
-
newInstance
@NotNull public static <T> T newInstance(@NotNull Constructor<T> constructor, Object[] args) throws InvocationTargetException, InstantiationException, IllegalAccessException create instance- Type Parameters:
T- instance type- Parameters:
constructor- create instanceargs- args- Returns:
- instance
- Throws:
InvocationTargetException- InvocationTargetExceptionInstantiationException- InstantiationExceptionIllegalAccessException- IllegalAccessException
-
safeNewInstance
public static <T> T safeNewInstance(@NotNull Constructor<T> constructor, Object[] args) throws Throwable safe create instance- Type Parameters:
T- instance type- Parameters:
constructor- create instanceargs- args- Returns:
- instance
- Throws:
InvocationTargetException- InvocationTargetExceptionInstantiationException- InstantiationExceptionIllegalAccessException- IllegalAccessExceptionThrowable
-