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


Java MetaMethod.getParameterTypes方法代码示例

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


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

示例1: findPropertyMissingMethod

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
@Nullable
private MetaMethod findPropertyMissingMethod(MetaClass metaClass) {
    if (metaClass instanceof MetaClassImpl) {
        // Reach into meta class to avoid lookup
        try {
            return (MetaMethod) MISSING_PROPERTY_GET_METHOD.get(metaClass);
        } catch (IllegalAccessException e) {
            throw UncheckedException.throwAsUncheckedException(e);
        }
    }

    // Query the declared methods of the meta class
    for (MetaMethod method : metaClass.getMethods()) {
        if (method.getName().equals("propertyMissing") && method.getParameterTypes().length == 1) {
            return method;
        }
    }
    return null;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:BeanDynamicObject.java

示例2: containsMatchingMethod

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
/**
 * @param list   a list of MetaMethods
 * @param method the MetaMethod of interest
 * @return true if a method of the same matching prototype was found in the
 *         list
 */
public static boolean containsMatchingMethod(List list, MetaMethod method) {
    for (Object aList : list) {
        MetaMethod aMethod = (MetaMethod) aList;
        CachedClass[] params1 = aMethod.getParameterTypes();
        CachedClass[] params2 = method.getParameterTypes();
        if (params1.length == params2.length) {
            boolean matches = true;
            for (int i = 0; i < params1.length; i++) {
                if (params1[i] != params2[i]) {
                    matches = false;
                    break;
                }
            }
            if (matches) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:groovy,代码行数:27,代码来源:MetaClassHelper.java

示例3: checkIfStdMethod

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
public void checkIfStdMethod(MetaMethod method) {
    if (method.getClass() != NewInstanceMetaMethod.class) {
        String name = method.getName();

        if (method.getParameterTypes().length != 1)
            return;

        if (!method.getParameterTypes()[0].isNumber && method.getParameterTypes()[0].getTheClass() != Object.class)
            return;

        if (!NAMES.contains(name))
            return;

        checkNumberOps(name, method.getDeclaringClass().getTheClass());
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:17,代码来源:NumberMathModificationInfo.java

示例4: isMatchingMethod

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
private static boolean isMatchingMethod(MetaMethod aMethod, MetaMethod method) {
    if (aMethod==method) return true;
    CachedClass[] params1 = aMethod.getParameterTypes();
    CachedClass[] params2 = method.getParameterTypes();
    if (params1.length != params2.length) {
        return false;
    }

    boolean matches = true;
    for (int i = 0; i < params1.length; i++) {
        if (params1[i] != params2[i]) {
            matches = false;
            break;
        }
    }
    return matches;
}
 
开发者ID:apache,项目名称:groovy,代码行数:18,代码来源:MetaMethodIndex.java

示例5: methodInfo

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
protected String[] methodInfo(MetaMethod method) {
    String[] result = new String[MEMBER_EXCEPTIONS_IDX + 1];
    int mod = method.getModifiers();
    result[MEMBER_ORIGIN_IDX] = GROOVY;
    result[MEMBER_MODIFIER_IDX] = Modifier.toString(mod);
    result[MEMBER_DECLARER_IDX] = shortName(method.getDeclaringClass().getTheClass());
    result[MEMBER_TYPE_IDX] = shortName(method.getReturnType());
    result[MEMBER_NAME_IDX] = method.getName();
    CachedClass[] params = method.getParameterTypes();
    StringBuilder sb = new StringBuilder();
    for (int j = 0; j < params.length; j++) {
        sb.append(shortName(params[j].getTheClass()));
        if (j < (params.length - 1)) sb.append(", ");
    }
    result[MEMBER_PARAMS_IDX] = sb.toString();
    result[MEMBER_EXCEPTIONS_IDX] = NOT_APPLICABLE; // no exception info for Groovy MetaMethods
    return withoutNulls(result);
}
 
开发者ID:apache,项目名称:groovy,代码行数:19,代码来源:Inspector.java

示例6: RankableMethod

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
public RankableMethod(String name, Class[] argumentTypes, MetaMethod m2) {
    this.m = m2;
    int nameDist = delDistance(name, m2.getName());

    //unbox primitives
    Class[] mArgs = new Class[m2.getParameterTypes().length];
    for(int i =0; i < mArgs.length; i++){
        //All args have to be boxed since argumentTypes is always boxed
        mArgs[i] = boxVar(m2.getParameterTypes()[i].getTheClass());
    }
    int argDist = damerauLevenshteinDistance(argumentTypes,mArgs);
    this.score = nameDist + argDist;
}
 
开发者ID:apache,项目名称:groovy,代码行数:14,代码来源:MethodRankHelper.java

示例7: isGenericSetMethod

import groovy.lang.MetaMethod; //导入方法依赖的package包/类
public static boolean isGenericSetMethod(MetaMethod method) {
    return (method.getName().equals("set"))
            && method.getParameterTypes().length == 2;
}
 
开发者ID:apache,项目名称:groovy,代码行数:5,代码来源:MetaClassHelper.java


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