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


Java MetaClassHelper.sameClasses方法代码示例

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


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

示例1: retrieveStaticMethod

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
public MetaMethod retrieveStaticMethod(String methodName, Object[] arguments) {
    final MetaMethodIndex.Entry e = metaMethodIndex.getMethods(theClass, methodName);
    MetaMethodIndex.CacheEntry cacheEntry;
    if (e != null) {
        cacheEntry = e.cachedStaticMethod;

        if (cacheEntry != null &&
            MetaClassHelper.sameClasses(cacheEntry.params, arguments, e.staticMethods instanceof MetaMethod))
        {
             return cacheEntry.method;
        }

        final Class[] classes = MetaClassHelper.convertToTypeArray(arguments);
        cacheEntry = new MetaMethodIndex.CacheEntry (classes, pickStaticMethod(methodName, classes));

        e.cachedStaticMethod = cacheEntry;

        return cacheEntry.method;
    }
    else
      return pickStaticMethod(methodName, MetaClassHelper.convertToTypeArray(arguments));
}
 
开发者ID:apache,项目名称:groovy,代码行数:23,代码来源:MetaClassImpl.java

示例2: getNormalMethodWithCaching

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
private MetaMethod getNormalMethodWithCaching(Object[] arguments, MetaMethodIndex.Entry e) {
    MetaMethodIndex.CacheEntry cacheEntry;
    final Object methods = e.methods;
    if (methods == null)
      return null;

    cacheEntry = e.cachedMethod;

    if (cacheEntry != null &&
        MetaClassHelper.sameClasses(cacheEntry.params, arguments, methods instanceof MetaMethod))
    {
        MetaMethod method = cacheEntry.method;
        if (method!=null) return method;
    }

    final Class[] classes = MetaClassHelper.convertToTypeArray(arguments);
    cacheEntry = new MetaMethodIndex.CacheEntry (classes, (MetaMethod) chooseMethod(e.name, methods, classes));

    e.cachedMethod = cacheEntry;

    return cacheEntry.method;
}
 
开发者ID:apache,项目名称:groovy,代码行数:23,代码来源:MetaClassImpl.java

示例3: callConstructor

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
public final Object callConstructor(Object receiver, Object[] args) throws Throwable {
    if (receiver == metaClass.getTheClass() // meta class match receiver
       && ((MetaClassImpl)metaClass).getVersion() == version // metaClass still be valid
       && MetaClassHelper.sameClasses(params, args) )  
    {
        MetaClassHelper.unwrap(args);
        try {
            return metaMethod.doMethodInvoke(metaClass.getTheClass(), args);
        } catch (GroovyRuntimeException gre) {
            throw ScriptBytecodeAdapter.unwrap(gre);
        }
    } else {
      return CallSiteArray.defaultCallConstructor(this, receiver, args);
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:16,代码来源:ConstructorMetaMethodSite.java

示例4: checkCall

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
protected final boolean checkCall(Object receiver, Object[] args) {
    try {
        return receiver.getClass() == metaClass.getTheClass() // meta class match receiver
           && checkPojoMetaClass()
           && MetaClassHelper.sameClasses(params, args);
    }
    catch (NullPointerException e) {
        if (receiver == null)
          return checkCall(NullObject.getNullObject(), args);

        throw e;
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:14,代码来源:PojoMetaMethodSite.java

示例5: checkCall

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
protected final boolean checkCall(Object receiver, Object[] args) {
    return receiver == metaClass.getTheClass() // meta class match receiver
       && ((MetaClassImpl)metaClass).getVersion() == version // metaClass still be valid
       && MetaClassHelper.sameClasses(params, args);
}
 
开发者ID:apache,项目名称:groovy,代码行数:6,代码来源:StaticMetaMethodSite.java

示例6: checkCall

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
protected boolean checkCall(Object receiver, Object[] args) {
    return nonParamCheck(receiver)
            && MetaClassHelper.sameClasses(params, args);
}
 
开发者ID:apache,项目名称:groovy,代码行数:5,代码来源:PogoMetaMethodSite.java

示例7: checkCall

import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
protected final boolean checkCall(Object receiver, Object[] args) {
    return receiver == metaClass.getTheClass() // meta class match receiver
            && ((MetaClassImpl) metaClass).getVersion() == version // metaClass still be valid
            && MetaClassHelper.sameClasses(params, args);
}
 
开发者ID:apache,项目名称:groovy,代码行数:6,代码来源:ConstructorSite.java


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