本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.getDeclaredMethod()
方法的一些代码示例,展示了MetaClass.getDeclaredMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.getDeclaredMethod()
方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:getDeclaredMethod
暂无
代码示例来源:origin: errai/errai
public static MetaMethod get(final Method method) {
return get(method.getDeclaringClass()).getDeclaredMethod(method.getName(), method.getParameterTypes());
}
代码示例来源:origin: org.jboss.errai/errai-codegen
public static MetaMethod get(final Method method) {
return get(method.getDeclaringClass()).getDeclaredMethod(method.getName(), method.getParameterTypes());
}
代码示例来源:origin: errai/errai
static MetaMethod getOverridenMethod(final MetaMethod specializingMethod) {
final MetaClass[] producerParams = GraphUtil.getParameterTypes(specializingMethod);
MetaClass enclosingType = specializingMethod.getDeclaringClass();
MetaMethod specializedMethod = null;
while (specializedMethod == null && enclosingType.getSuperClass() != null) {
enclosingType = enclosingType.getSuperClass();
specializedMethod = enclosingType.getDeclaredMethod(specializingMethod.getName(), producerParams);
}
return specializedMethod;
}
代码示例来源:origin: errai/errai
@Test
public void testFieldWithSingleUpperBoundedTypeVarParam() throws Exception {
final MetaClass metaClass = getMetaClass(ClassWithGenericCollections.class);
final MetaMethod field = metaClass.getDeclaredMethod("hasSingleBoundedTypeVarFromSelf", new Class[] {});
assertNotNull(field);
final MetaTypeVariable returnType = (MetaTypeVariable) field.getGenericReturnType();
assertEquals("B", returnType.getName());
assertEquals("Should have a single upper bound",
Arrays.asList(getMetaClass(Serializable.class)),
Arrays.asList(returnType.getBounds()));
}
代码示例来源:origin: errai/errai
@Test
public void testFieldWithTwoUpperBoundedTypeVarParam() throws Exception {
final MetaClass metaClass = getMetaClass(ClassWithGenericCollections.class);
final MetaMethod field = metaClass.getDeclaredMethod("hasDoubleBoundedTypeVarFromSelf", new Class[] {});
assertNotNull(field);
final MetaTypeVariable returnType = (MetaTypeVariable) field.getGenericReturnType();
assertEquals("B", returnType.getName());
assertEquals("Should have two upper bounds",
Arrays.asList(getMetaClass(Collection.class), getMetaClass(Serializable.class)),
Arrays.asList(returnType.getBounds()));
}
代码示例来源:origin: errai/errai
@Override
public void makeMethodAccessible(final ClassStructureBuilder<?> classBuilder,
final MetaMethod method,
final Modifier[] modifiers) {
final MetaMethod erasedMethod = method.getDeclaringClass().getErased().getDeclaredMethod(method.getName(),
getErasedParamterTypes(method));
final List<Parameter> wrapperDefParms = new ArrayList<Parameter>();
if (!erasedMethod.isStatic()) {
wrapperDefParms.add(Parameter.of(erasedMethod.getDeclaringClass().getErased(), "instance"));
}
final List<Parameter> methodDefParms = DefParameters.from(erasedMethod).getParameters();
wrapperDefParms.addAll(methodDefParms);
Annotation[] annotations = NO_ANNOTATIONS;
for (MetaParameter p : erasedMethod.getParameters()) {
if (p.getType().getCanonicalName().equals("long")) {
annotations = new Annotation[] { UNSAFE_NATIVE_LONG_ANNOTATION };
}
}
if (erasedMethod.getReturnType().getCanonicalName().equals("long")) {
annotations = new Annotation[] { UNSAFE_NATIVE_LONG_ANNOTATION };
}
classBuilder.publicMethod(erasedMethod.getReturnType(), PrivateAccessUtil.getPrivateMethodName(method))
.annotatedWith(annotations)
.parameters(DefParameters.fromParameters(wrapperDefParms))
.modifiers(appendJsni(modifiers))
.body()
._(StringStatement.of(JSNIUtil.methodAccess(erasedMethod)))
.finish();
}
代码示例来源:origin: org.jboss.errai/errai-codegen-gwt
@Override
public void makeMethodAccessible(final ClassStructureBuilder<?> classBuilder,
final MetaMethod method,
final Modifier[] modifiers) {
final MetaMethod erasedMethod = method.getDeclaringClass().getErased().getDeclaredMethod(method.getName(),
getErasedParamterTypes(method));
final List<Parameter> wrapperDefParms = new ArrayList<Parameter>();
if (!erasedMethod.isStatic()) {
wrapperDefParms.add(Parameter.of(erasedMethod.getDeclaringClass().getErased(), "instance"));
}
final List<Parameter> methodDefParms = DefParameters.from(erasedMethod).getParameters();
wrapperDefParms.addAll(methodDefParms);
Annotation[] annotations = NO_ANNOTATIONS;
for (MetaParameter p : erasedMethod.getParameters()) {
if (p.getType().getCanonicalName().equals("long")) {
annotations = new Annotation[] { UNSAFE_NATIVE_LONG_ANNOTATION };
}
}
if (erasedMethod.getReturnType().getCanonicalName().equals("long")) {
annotations = new Annotation[] { UNSAFE_NATIVE_LONG_ANNOTATION };
}
classBuilder.publicMethod(erasedMethod.getReturnType(), PrivateAccessUtil.getPrivateMethodName(method))
.annotatedWith(annotations)
.parameters(DefParameters.fromParameters(wrapperDefParms))
.modifiers(appendJsni(modifiers))
.body()
._(StringStatement.of(JSNIUtil.methodAccess(erasedMethod)))
.finish();
}
内容来源于网络,如有侵权,请联系作者删除!