Added in API level 34

OfMethod

interface OfMethod<F : TypeDescriptor.OfField<F>!, M : TypeDescriptor.OfMethod<F, M>!> : TypeDescriptor
java.lang.invoke.TypeDescriptor.OfMethod

An entity that has a method type descriptor Method descriptors conforming to JVMS {@jvms 4.3.3} can be described

Summary

Public methods
abstract M
changeParameterType(index: Int, paramType: F)

Return a method descriptor that is identical to this one, except that a single parameter type has been changed to the specified type.

abstract M
changeReturnType(newReturn: F)

Return a method descriptor that is identical to this one, except that the return type has been changed to the specified type

abstract M
dropParameterTypes(start: Int, end: Int)

Return a method descriptor that is identical to this one, except that a range of parameter types have been removed.

abstract M
insertParameterTypes(pos: Int, vararg paramTypes: F)

Return a method descriptor that is identical to this one, except that a range of additional parameter types have been inserted.

abstract Array<F>!

Return an array of field descriptors for the parameter types of the method type described by this descriptor

abstract Int

Return the number of parameters in the method type

abstract MutableList<F>!

Return an immutable list of field descriptors for the parameter types of the method type described by this descriptor

abstract F

Return a field descriptor describing the requested parameter of the method type described by this descriptor

abstract F

Return a field descriptor describing the return type of the method type described by this descriptor

Inherited functions

Public methods

changeParameterType

Added in API level 34
abstract fun changeParameterType(
    index: Int,
    paramType: F
): M

Return a method descriptor that is identical to this one, except that a single parameter type has been changed to the specified type.

Parameters
index Int: the index of the parameter to change
paramType F: a field descriptor describing the new parameter type
Return
M the new method descriptor
Exceptions
java.lang.NullPointerException if any argument is null
java.lang.IndexOutOfBoundsException if the index is outside the half-open range {[0, parameterCount)}

changeReturnType

Added in API level 34
abstract fun changeReturnType(newReturn: F): M

Return a method descriptor that is identical to this one, except that the return type has been changed to the specified type

Parameters
newReturn F: a field descriptor for the new return type
Return
M the new method descriptor
Exceptions
java.lang.NullPointerException if any argument is null

dropParameterTypes

Added in API level 34
abstract fun dropParameterTypes(
    start: Int,
    end: Int
): M

Return a method descriptor that is identical to this one, except that a range of parameter types have been removed.

Parameters
start Int: the index of the first parameter to remove
end Int: the index after the last parameter to remove
Return
M the new method descriptor
Exceptions
java.lang.IndexOutOfBoundsException if start is outside the half-open range [0, parameterCount), or end is outside the closed range [0, parameterCount], or if start > end

insertParameterTypes

Added in API level 34
abstract fun insertParameterTypes(
    pos: Int,
    vararg paramTypes: F
): M

Return a method descriptor that is identical to this one, except that a range of additional parameter types have been inserted.

Parameters
pos Int: the index at which to insert the first inserted parameter
paramTypes F: field descriptors describing the new parameter types to insert
Return
M the new method descriptor
Exceptions
java.lang.NullPointerException if any argument is null
java.lang.IndexOutOfBoundsException if pos is outside the closed range {[0, parameterCount]}

parameterArray

Added in API level 34
abstract fun parameterArray(): Array<F>!

Return an array of field descriptors for the parameter types of the method type described by this descriptor

Return
Array<F>! field descriptors for the parameter types

parameterCount

Added in API level 34
abstract fun parameterCount(): Int

Return the number of parameters in the method type

Return
Int the number of parameters

parameterList

Added in API level 34
abstract fun parameterList(): MutableList<F>!

Return an immutable list of field descriptors for the parameter types of the method type described by this descriptor

Return
MutableList<F>! field descriptors for the parameter types

parameterType

Added in API level 34
abstract fun parameterType(i: Int): F

Return a field descriptor describing the requested parameter of the method type described by this descriptor

Parameters
i Int: the index of the parameter
Return
F a field descriptor for the requested parameter type
Exceptions
java.lang.IndexOutOfBoundsException if the index is outside the half-open range {[0, parameterCount)}

returnType

Added in API level 34
abstract fun returnType(): F

Return a field descriptor describing the return type of the method type described by this descriptor

Return
F a field descriptor for the return type