當前位置: 首頁>>代碼示例>>Java>>正文


Java Reflection.invokeMethod方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:gdx-libs,項目名稱:gdx-autumn,代碼行數:12,代碼來源:MethodInvocation.java

示例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);
    }
}
 
開發者ID:gdx-libs,項目名稱:gdx-autumn,代碼行數:11,代碼來源:ReflectionDependencyProvider.java

示例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);
    }
}
 
開發者ID:czyzby,項目名稱:gdx-lml,代碼行數:13,代碼來源:AbstractLmlParser.java

示例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);
    }
}
 
開發者ID:czyzby,項目名稱:gdx-lml,代碼行數:13,代碼來源:MethodActorConsumer.java


注:本文中的com.github.czyzby.kiwi.util.gdx.reflection.Reflection.invokeMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。