- Obtaining Method Type Informatio
- Obtaining Names of Method Parame
- iOS开发笔记-67:swift4-代理-protocol-op
- The method replace(int, Fragment
- Unknown argument type '__attribu
- iOS开发笔记-67:swift4-代理-protocol-op
- eclipse:The method findAccountBy
- Unknown argument type '__attribu
- RN--IOS--xcode11--遇到React Native
- RN项目iOS端红色屏幕报错Unknown argument t
本系列翻译自Oracle官方教程,半翻译,半读后感性质。文末会附上原文链接。
方法的声明包括:方法名、修饰符、参数、返回值和异常。
根据是否区分泛型,对应于2组方法:
-
getReturnType()
、getParameterTypes()
、getExceptionTypes()
-
getGenericReturnType()
、getGenericParameterTypes()
、getGenericExceptionTypes()
//- 源码中函数的定义
public Constructor<T> getConstructor(Class<?>... parameterTypes)
//- returnType():
//- class java.lang.reflect.Constructor
//- genericReturnType():
//- java.lang.reflect.Constructor<T>
另外,通过不带*Generic*
的方法可以看到泛型被擦除之后,是转为类型的上界(原文是:... is replaced by the upper bound of the type variable ...)
//- 源码中函数的定义
public T cast(Object obj)
//- returnType():
//- class java.lang.Object
//- genericReturnType():
// T
网友评论