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


Java Method.getReturnType方法代码示例

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


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

示例1: convertToProviders

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/** @param component is the owner of the methods.
 * @param methods will be converted to dependency providers and added to context.
 * @param context will contain the providers. Used to resolve methods' dependencies. */
protected void convertToProviders(final Object component, final Method[] methods, final Context context) {
    for (final Method method : methods) {
        final Class<?> returnType = method.getReturnType();
        if (Annotations.isNotVoid(returnType)) { // Not null, void or Void.
            context.addProvider(new ReflectionDependencyProvider(context, method, component));
        }
    }
}
 
开发者ID:gdx-libs,项目名称:gdx-autumn,代码行数:12,代码来源:ProviderAnnotationProcessor.java

示例2: isValidFactoryMethod

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/** @param method cannot be synthetic, return void, have a forbidden name or have any filtered modifiers.
 * @return true if the method is valid and should be converted to a provider. */
protected boolean isValidFactoryMethod(final Method method) {
    final int modifiers = Modifier.getModifiers(method);
    return (modifiers & getMethodsIgnoreFilter()) == 0 && modifiers != getMethodsIgnoreSignature()
            && method.getReturnType() != void.class && method.getReturnType() != Void.class
            && !FORBIDDEN_METHOD_NAMES.contains(method.getName());
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:9,代码来源:DefaultContext.java

示例3: 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

示例4: initializeBehavior

import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/**
 * Default implementation relies in reflection to set the attributes
 */
protected void initializeBehavior(S event, Class eventClass,
		T runtimeBehavior) {
	Method[] methods = ClassReflection.getDeclaredMethods(eventClass);
	for (Method get : methods) {
		String getPrefix = get.getName().startsWith("get") ? "get" : "is";
		if (get.getName().startsWith("get")
				|| get.getName().startsWith("is")) {
			// Search equivalent set method in runtimeBehavior
			String setMethodName = "set"
					+ get.getName().substring(getPrefix.length());
			Class returningType = get.getReturnType();
			try {
				Method set = ClassReflection.getDeclaredMethod(
						runtimeBehavior.getClass(), setMethodName,
						returningType);
				if (set != null) {
					set.invoke(runtimeBehavior, get.invoke(event));
				}
			} catch (ReflectionException e) {
				Gdx.app.error("BehaviorComponent",
						"Error initializing behavior", e);
			}
		}
	}

	if (eventClass.getSuperclass() != null
			&& eventClass.getSuperclass() != Object.class) {
		initializeBehavior(event, eventClass.getSuperclass(),
				runtimeBehavior);
	}
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:35,代码来源:BehaviorComponent.java


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