本文整理汇总了Java中com.github.czyzby.kiwi.util.gdx.reflection.Reflection.invokeMethod方法的典型用法代码示例。如果您正苦于以下问题:Java Reflection.invokeMethod方法的具体用法?Java Reflection.invokeMethod怎么用?Java Reflection.invokeMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.czyzby.kiwi.util.gdx.reflection.Reflection
的用法示例。
在下文中一共展示了Reflection.invokeMethod方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import com.github.czyzby.kiwi.util.gdx.reflection.Reflection; //导入方法依赖的package包/类
/** Invokes the stored method with the chosen arguments.
*
* @return result of the invoked method. */
public Object invoke() {
try {
return Reflection.invokeMethod(method, methodOwner, parameters);
} catch (final Exception exception) {
throw new GdxRuntimeException("Unable to invoke method: " + method.getName() + " of type: " + methodOwner
+ " with parameters: " + GdxArrays.newArray(parameters), exception);
}
}
示例2: provide
import com.github.czyzby.kiwi.util.gdx.reflection.Reflection; //导入方法依赖的package包/类
@Override
public Object provide() {
try {
return Reflection.invokeMethod(providerMethod, methodOwner,
MethodInvocation.getParametersFromContext(providerMethod.getParameterTypes(), context));
} catch (final ReflectionException exception) {
throw new GdxRuntimeException("Unable to invoke method: " + providerMethod + " of provider: " + methodOwner,
exception);
}
}
示例3: invokeAnnotatedViewMethod
import com.github.czyzby.kiwi.util.gdx.reflection.Reflection; //导入方法依赖的package包/类
protected <View> void invokeAnnotatedViewMethod(final View view, final Method method) throws ReflectionException {
final Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes == null || parameterTypes.length == 0) {
Reflection.invokeMethod(method, view, (Object[]) Strings.EMPTY_ARRAY);
} else if (parameterTypes.length == 1 && LmlParser.class.equals(parameterTypes[0])) {
Reflection.invokeMethod(method, view, new Object[] { this });
} else {
throw new GdxRuntimeException(
"Only no-arg or single-arg methods consuming LmlParser can be annotated. Found invalid args on annotated method: "
+ method);
}
}
示例4: consume
import com.github.czyzby.kiwi.util.gdx.reflection.Reflection; //导入方法依赖的package包/类
@Override
public Object consume(final Object actor) {
if (containsArgument()) {
arguments[0] = actor;
}
try {
return Reflection.invokeMethod(method, methodOwner, arguments);
} catch (final Exception exception) {
throw new GdxRuntimeException("Unable to invoke method: " + method + " of object: " + methodOwner
+ (containsArgument() ? " with argument: " + actor : ""), exception);
}
}