本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getBestMatchingMethod()
方法的一些代码示例,展示了MetaClass.getBestMatchingMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getBestMatchingMethod()
方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getBestMatchingMethod
暂无
代码示例来源:origin: errai/errai
@Override
public BlockBuilder<AnonymousClassStructureBuilder> publicOverridesMethod(final String name, final Parameter... args) {
final List<MetaClass> types = new ArrayList<MetaClass>();
Arrays.stream(args).forEach(a -> types.add(a.getType()));
final MetaMethod method = classDefinition.getSuperClass()
.getBestMatchingMethod(name, types.toArray(new MetaClass[args.length]));
if (method == null)
throw new UndefinedMethodException("Can't override (inherited method not found):"
+ classDefinition.getFullyQualifiedNameWithTypeParms() + "." + name + "(" + types + ")");
return publicOverridesMethod(method, DefParameters.fromParameters(args));
}
代码示例来源:origin: org.jboss.errai/errai-codegen
@Override
public BlockBuilder<AnonymousClassStructureBuilder> publicOverridesMethod(final String name, final Parameter... args) {
final List<MetaClass> types = new ArrayList<MetaClass>();
Arrays.stream(args).forEach(a -> types.add(a.getType()));
final MetaMethod method = classDefinition.getSuperClass()
.getBestMatchingMethod(name, types.toArray(new MetaClass[args.length]));
if (method == null)
throw new UndefinedMethodException("Can't override (inherited method not found):"
+ classDefinition.getFullyQualifiedNameWithTypeParms() + "." + name + "(" + types + ")");
return publicOverridesMethod(method, DefParameters.fromParameters(args));
}
代码示例来源:origin: errai/errai
MetaMethod method = eventType.getBestMatchingMethod("getAssociatedType", Type.class);
代码示例来源:origin: org.jboss.errai/errai-ui
MetaMethod method = eventType.getBestMatchingMethod("getAssociatedType", Type.class);
代码示例来源:origin: errai/errai
@Test
public void testLookupOfMethodWithArrayParameters() {
final MetaClass metaClass = MetaClassFactory.get(Arrays.class);
final MetaMethod equals = metaClass.getBestMatchingMethod("equals", Class[].class, Class[].class);
assertEquals("public boolean equals([[Ljava.lang.Object;, [Ljava.lang.Object;])", equals.toString());
}
}
代码示例来源:origin: errai/errai
: callType.getBestMatchingMethod(methodName, parameterTypes);
代码示例来源:origin: org.jboss.errai/errai-codegen
: callType.getBestMatchingMethod(methodName, parameterTypes);
代码示例来源:origin: errai/errai
/**
* This reproduces a bug found in the JavaReflectionClass.
* PortableIntegerParameterDefinition overrides a method with a generic return
* type (getValue). Class.getDeclaredMethods returns a bridge method with a
* return type of the upper type bound (in this case, Serializable). This
* resulted in JavaReflectionClass.getMethods() returning a MetaMethod for
* bridge method with the wrong return type, leading to seemingly mysterious
* codegen errors.
*/
@Test
public void testMethodReturnTypeIsSpecializedTypeAndNotFromBridgeMethod() throws Exception {
final MetaClass mc = getMetaClassImpl(PortableIntegerParameterDefinition.class);
final MetaMethod method = mc.getBestMatchingMethod("getValue", new MetaClass[0]);
final ContextualStatementBuilder invokeStmt = nestedCall(newObject(mc)).invoke("getValue");
// Force statement to load return type
invokeStmt.toJavaString();
final MetaClass stmtReturnType = invokeStmt.getType();
final MetaClass expected = getMetaClassImpl(java.lang.Integer.class);
assertEquals(expected, method.getReturnType());
assertEquals(expected, stmtReturnType);
}
内容来源于网络,如有侵权,请联系作者删除!