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


Java TypeResolver类代码示例

本文整理汇总了Java中com.sun.beans.TypeResolver的典型用法代码示例。如果您正苦于以下问题:Java TypeResolver类的具体用法?Java TypeResolver怎么用?Java TypeResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: isEventHandler

import com.sun.beans.TypeResolver; //导入依赖的package包/类
private boolean isEventHandler(Method m) {
    // We assume that a method is an event handler if it has a single
    // argument, whose type inherit from java.util.Event.
    Type argTypes[] = m.getGenericParameterTypes();
    if (argTypes.length != 1) {
        return false;
    }
    return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:Introspector.java

示例2: internalFindMethod

import com.sun.beans.TypeResolver; //导入依赖的package包/类
/**
 * Internal support for finding a target methodName with a given
 * parameter list on a given class.
 */
private static Method internalFindMethod(Class<?> start, String methodName,
                                             int argCount, Class args[]) {
    // For overriden methods we need to find the most derived version.
    // So we start with the given class and walk up the superclass chain.

    Method method = null;

    for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
        Method methods[] = getPublicDeclaredMethods(cl);
        for (int i = 0; i < methods.length; i++) {
            method = methods[i];
            if (method == null) {
                continue;
            }

            // make sure method signature matches.
            if (method.getName().equals(methodName)) {
                Type[] params = method.getGenericParameterTypes();
                if (params.length == argCount) {
                    if (args != null) {
                        boolean different = false;
                        if (argCount > 0) {
                            for (int j = 0; j < argCount; j++) {
                                if (TypeResolver.erase(TypeResolver.resolveInClass(start, params[j])) != args[j]) {
                                    different = true;
                                    continue;
                                }
                            }
                            if (different) {
                                continue;
                            }
                        }
                    }
                    return method;
                }
            }
        }
    }
    method = null;

    // Now check any inherited interfaces.  This is necessary both when
    // the argument class is itself an interface, and when the argument
    // class is an abstract class.
    Class ifcs[] = start.getInterfaces();
    for (int i = 0 ; i < ifcs.length; i++) {
        // Note: The original implementation had both methods calling
        // the 3 arg method. This is preserved but perhaps it should
        // pass the args array instead of null.
        method = internalFindMethod(ifcs[i], methodName, argCount, null);
        if (method != null) {
            break;
        }
    }
    return method;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:Introspector.java

示例3: resolve

import com.sun.beans.TypeResolver; //导入依赖的package包/类
static Class<?> resolve(Method method, Type type) {
    return TypeResolver.erase(TypeResolver.resolveInClass(method.getDeclaringClass(), type));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:MethodInfo.java

示例4: internalFindMethod

import com.sun.beans.TypeResolver; //导入依赖的package包/类
/**
 * Internal support for finding a target methodName with a given
 * parameter list on a given class.
 */
private static Method internalFindMethod(Class start, String methodName,
                                             int argCount, Class args[]) {
    // For overriden methods we need to find the most derived version.
    // So we start with the given class and walk up the superclass chain.

    Method method = null;

    for (Class cl = start; cl != null; cl = cl.getSuperclass()) {
        Method methods[] = getPublicDeclaredMethods(cl);
        for (int i = 0; i < methods.length; i++) {
            method = methods[i];
            if (method == null) {
                continue;
            }

            // make sure method signature matches.
            if (method.getName().equals(methodName)) {
                Type[] params = method.getGenericParameterTypes();
                if (params.length == argCount) {
                    if (args != null) {
                        boolean different = false;
                        if (argCount > 0) {
                            for (int j = 0; j < argCount; j++) {
                                if (TypeResolver.erase(TypeResolver.resolveInClass(start, params[j])) != args[j]) {
                                    different = true;
                                    continue;
                                }
                            }
                            if (different) {
                                continue;
                            }
                        }
                    }
                    return method;
                }
            }
        }
    }
    method = null;

    // Now check any inherited interfaces.  This is necessary both when
    // the argument class is itself an interface, and when the argument
    // class is an abstract class.
    Class ifcs[] = start.getInterfaces();
    for (int i = 0 ; i < ifcs.length; i++) {
        // Note: The original implementation had both methods calling
        // the 3 arg method. This is preserved but perhaps it should
        // pass the args array instead of null.
        method = internalFindMethod(ifcs[i], methodName, argCount, null);
        if (method != null) {
            break;
        }
    }
    return method;
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:60,代码来源:Introspector.java

示例5: getReturnType

import com.sun.beans.TypeResolver; //导入依赖的package包/类
/**
 * Resolves the return type of the method.
 *
 * @param base    the class that contains the method in the hierarchy
 * @param method  the object that represents the method
 * @return a class identifying the return type of the method
 *
 * @see Method#getGenericReturnType
 * @see Method#getReturnType
 */
static Class<?> getReturnType(Class<?> base, Method method) {
    if (base == null) {
        base = method.getDeclaringClass();
    }
    return TypeResolver.erase(TypeResolver.resolveInClass(base, method.getGenericReturnType()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:FeatureDescriptor.java

示例6: getParameterTypes

import com.sun.beans.TypeResolver; //导入依赖的package包/类
/**
 * Resolves the parameter types of the method.
 *
 * @param base    the class that contains the method in the hierarchy
 * @param method  the object that represents the method
 * @return an array of classes identifying the parameter types of the method
 *
 * @see Method#getGenericParameterTypes
 * @see Method#getParameterTypes
 */
static Class<?>[] getParameterTypes(Class<?> base, Method method) {
    if (base == null) {
        base = method.getDeclaringClass();
    }
    return TypeResolver.erase(TypeResolver.resolveInClass(base, method.getGenericParameterTypes()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:FeatureDescriptor.java


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