本文整理汇总了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));
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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);
}
示例6: checkCall
import org.codehaus.groovy.runtime.MetaClassHelper; //导入方法依赖的package包/类
protected boolean checkCall(Object receiver, Object[] args) {
return nonParamCheck(receiver)
&& MetaClassHelper.sameClasses(params, args);
}
示例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);
}