当前位置: 首页>>代码示例>>Java>>正文


Java Method.getParameterTypes方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.reflect.Method.getParameterTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Method.getParameterTypes方法的具体用法?Java Method.getParameterTypes怎么用?Java Method.getParameterTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.reflect.Method的用法示例。


在下文中一共展示了Method.getParameterTypes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printCommands

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
@Override
public void printCommands () {
	for (Method m : getAllMethods()) {
		if (m.isPublic() && ConsoleUtils.canDisplayCommand(this, m)) {
			String s = "";
			s += m.getName();
			s += " : ";

			Class<?>[] params = m.getParameterTypes();
			for (int i = 0; i < params.length; i++) {
				s += params[i].getSimpleName();
				if (i < params.length - 1) {
					s += ", ";
				}
			}

			log(s);
		}
	}
}
 
开发者ID:StrongJoshua,项目名称:libgdx-inGameConsole,代码行数:21,代码来源:AbstractConsole.java

示例2: getParameters

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
private static Object[] getParameters(final Method method, final Context context) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes == null || parameterTypes.length == 0) {
        return Strings.EMPTY_ARRAY;
    }
    final Object[] parameters = new Object[parameterTypes.length];
    for (int index = 0, length = parameterTypes.length; index < length; index++) {
        final Class<?> parameterType = parameterTypes[index];
        if (context.isPresent(parameterType)) {
            parameters[index] = context.getComponent(parameterType);
        }
    }
    return parameters;
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn,代码行数:15,代码来源:ReflectionEventListener.java

示例3: getProviders

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
private static ObjectProvider<?>[] getProviders(final Method method, final Context context) {
    final Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes == null || parameterTypes.length == 0) {
        return new ObjectProvider<?>[0];
    }
    final ObjectProvider<?>[] providers = new ObjectProvider<?>[parameterTypes.length];
    for (int index = 0, length = parameterTypes.length; index < length; index++) {
        final Class<?> parameterType = parameterTypes[index];
        if (context.isProviderPresentFor(parameterType)) {
            providers[index] = context.getProvider(parameterType);
        }
    }
    return providers;
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn,代码行数:15,代码来源:ReflectionEventListener.java

示例4: invokeAnnotatedViewMethod

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的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

示例5: MethodActorConsumer

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
public MethodActorConsumer(final Method method, final Object methodOwner) {
    if (method == null || methodOwner == null) {
        throw new IllegalArgumentException(
                "Method actor consumer has to wrap around an existing method and its owner.");
    }
    this.method = method;
    this.methodOwner = methodOwner;
    final Class<?>[] parameters = method.getParameterTypes();
    if (parameters == null || parameters.length == 0) {
        arguments = LmlUtilities.EMPTY_ARRAY;
    } else {
        arguments = new Object[1];
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:15,代码来源:MethodActorConsumer.java

示例6: ReflectionProvider

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/** @param context parent context.
 * @param owner instance of the class with the method.
 * @param method will be wrapped and converted into a provider. */
public ReflectionProvider(final Context context, final Object owner, final Method method) {
    this.context = context;
    this.owner = owner;
    this.method = method;
    type = method.getReturnType();
    parameterTypes = method.getParameterTypes();
    parameters = parameterTypes.length == 0 ? Providers.EMPTY_ARRAY : new Object[parameterTypes.length];
    name = Providers.getName(method);
    isDefault = owner instanceof Default;
    methodMember = new MethodMember(method);
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:15,代码来源:ReflectionProvider.java


注:本文中的com.badlogic.gdx.utils.reflect.Method.getParameterTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。