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


Java TypeResolver.erase方法代码示例

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


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

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

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

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

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

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

示例6: 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:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:17,代码来源:FeatureDescriptor.java

示例7: 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:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:17,代码来源:FeatureDescriptor.java


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