public sealed interface MethodTypeDesc extends ConstantDesc , TypeDescriptor.OfMethod <ClassDesc ,MethodTypeDesc >
名义描述符 代表 MethodType 常量。
- 自从:
- 12
-
内部类总结
在接口 java.lang.invoke.TypeDescriptor 中声明的嵌套类/接口
TypeDescriptor.OfField<F extends TypeDescriptor.OfField<F>>, TypeDescriptor.OfMethod<F extends TypeDescriptor.OfField<F>,
M extends TypeDescriptor.OfMethod<F, M>> -
方法总结
修饰符和类型方法描述changeParameterType
(int index, ClassDesc paramType) 返回与此相同的 MethodTypeDesc,只是单个参数类型已更改为指定类型。changeReturnType
(ClassDesc returnType) 返回与此相同的 MethodTypeDesc,但具有指定的返回类型。default String
返回方法类型描述符字符串。default String
使用参数和返回类型的规范名称返回此方法类型的人类可读描述符。dropParameterTypes
(int start, int end) 返回一个与此相同的 MethodTypeDesc,只是删除了一系列参数类型。boolean
比较指定对象与此描述符是否相等。insertParameterTypes
(int pos, ClassDesc... paramTypes) 返回与此相同的 MethodTypeDesc,只是插入了一系列附加参数类型。static MethodTypeDesc
返回一个 MethodTypeDesc 给定返回类型和参数类型。static MethodTypeDesc
ofDescriptor
(String descriptor) 创建一个给定方法描述符字符串的 MethodTypeDesc。将参数类型作为数组返回。int
返回此 MethodTypeDesc 描述的方法类型的参数数量。将参数类型作为不可变的List
返回。parameterType
(int index) 返回此 MethodTypeDesc 描述的方法类型的第index
个参数的参数类型。获取此 MethodTypeDesc 描述的方法类型的返回类型。在接口 java.lang.constant.ConstantDesc 中声明的方法
resolveConstantDesc
-
方法详情
-
ofDescriptor
创建一个给定方法描述符字符串的 MethodTypeDesc。- 参数:
descriptor
- 方法描述符字符串- 返回:
- MethodTypeDesc 描述所需的方法类型
- 抛出:
NullPointerException
- 如果参数是null
IllegalArgumentException
- 如果描述符字符串不是有效的方法描述符- 看Java 虚拟机规范:
-
4.3.3 方法描述符
-
of
返回一个 MethodTypeDesc 给定返回类型和参数类型。- 参数:
returnDesc
- 描述返回类型的 ClassDescparamDescs
- ClassDesc s 描述参数类型- 返回:
- MethodTypeDesc 描述所需的方法类型
- 抛出:
NullPointerException
- 如果任何参数或其内容是null
IllegalArgumentException
- 如果paramDescs
的任何元素是ClassDesc
forvoid
-
returnType
ClassDesc returnType()获取此 MethodTypeDesc 描述的方法类型的返回类型。- 指定者:
returnType
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 返回:
-
a
ClassDesc
描述方法类型的返回类型
-
parameterCount
int parameterCount()返回此 MethodTypeDesc 描述的方法类型的参数数量。- 指定者:
parameterCount
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 返回:
- 参数个数
-
parameterType
返回此 MethodTypeDesc 描述的方法类型的第index
个参数的参数类型。- 指定者:
parameterType
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 参数:
index
- 要检索的参数的索引- 返回:
ClassDesc
描述所需的参数类型- 抛出:
IndexOutOfBoundsException
- 如果索引超出半开范围 {[0, parameterCount())}
-
parameterList
将参数类型作为不可变的List
返回。- 指定者:
parameterList
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 返回:
List
ofClassDesc
描述参数类型
-
parameterArray
ClassDesc [] parameterArray()将参数类型作为数组返回。- 指定者:
parameterArray
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 返回:
-
描述参数类型的
ClassDesc
数组
-
changeReturnType
返回与此相同的 MethodTypeDesc,但具有指定的返回类型。- 指定者:
changeReturnType
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 参数:
returnType
- 一个ClassDesc
描述新的返回类型- 返回:
- MethodTypeDesc 描述所需的方法类型
- 抛出:
NullPointerException
- 如果参数是null
-
changeParameterType
返回与此相同的 MethodTypeDesc,只是单个参数类型已更改为指定类型。- 指定者:
changeParameterType
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 参数:
index
- 要更改的参数的索引paramType
- 描述新参数类型的ClassDesc
- 返回:
- MethodTypeDesc 描述所需的方法类型
- 抛出:
NullPointerException
- 如果任何参数是null
IndexOutOfBoundsException
- 如果索引超出半开范围 {[0, parameterCount)}
-
dropParameterTypes
返回一个与此相同的 MethodTypeDesc,只是删除了一系列参数类型。- 指定者:
dropParameterTypes
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 参数:
start
- 要删除的第一个参数的索引end
- 要删除的最后一个参数之后的索引- 返回:
- MethodTypeDesc 描述所需的方法类型
- 抛出:
IndexOutOfBoundsException
- 如果start
在半开范围[0, parameterCount)
之外,或者end
在封闭范围[0, parameterCount]
之外,或者如果start > end
-
insertParameterTypes
返回与此相同的 MethodTypeDesc,只是插入了一系列附加参数类型。- 指定者:
insertParameterTypes
在接口TypeDescriptor.OfMethod<ClassDesc,
中MethodTypeDesc> - 参数:
pos
- 插入第一个插入参数的索引paramTypes
-ClassDesc
s 描述要插入的新参数类型- 返回:
- MethodTypeDesc 描述所需的方法类型
- 抛出:
NullPointerException
- 如果任何参数或其内容是null
IndexOutOfBoundsException
- 如果pos
超出封闭范围 {[0, parameterCount]}IllegalArgumentException
- 如果paramTypes
的任何元素是void
的ClassDesc
-
descriptorString
返回方法类型描述符字符串。- 指定者:
descriptorString
在接口TypeDescriptor
中- 返回:
- 方法类型描述符字符串
- 看Java 虚拟机规范:
-
4.3.3 方法描述符
-
displayDescriptor
使用参数和返回类型的规范名称返回此方法类型的人类可读描述符。- 返回:
- 此方法类型的人类可读描述符
-
equals
比较指定对象与此描述符是否相等。返回true
当且仅当指定对象也是一个 MethodTypeDesc 两者具有相同的元数,它们的返回类型相等,并且每对对应的参数类型相等。
-