Added in API level 34

TypeDescriptor.OfMethod

public static interface TypeDescriptor.OfMethod
implements TypeDescriptor

java.lang.invoke.TypeDescriptor.OfMethod<F extends java.lang.invoke.TypeDescriptor.OfField<F>, M extends java.lang.invoke.TypeDescriptor.OfMethod<F, M>>


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(int index, F paramType)

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(F newReturn)

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(int start, int end)

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

abstract M insertParameterTypes(int pos, F... paramTypes)

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

abstract F[] parameterArray()

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

abstract int parameterCount()

Return the number of parameters in the method type

abstract List<F> parameterList()

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

abstract F parameterType(int i)

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

abstract F returnType()

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

Inherited methods

Public methods

changeParameterType

Added in API level 34
public abstract M changeParameterType (int index, 
                F paramType)

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

Returns
M the new method descriptor

Throws
NullPointerException if any argument is null
IndexOutOfBoundsException if the index is outside the half-open range {[0, parameterCount)}

changeReturnType

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

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

Returns
M the new method descriptor

Throws
NullPointerException if any argument is null

dropParameterTypes

Added in API level 34
public abstract M dropParameterTypes (int start, 
                int end)

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

Returns
M the new method descriptor

Throws
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
public abstract M insertParameterTypes (int pos, 
                F... paramTypes)

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

Returns
M the new method descriptor

Throws
NullPointerException if any argument is null
IndexOutOfBoundsException if pos is outside the closed range {[0, parameterCount]}

parameterArray

Added in API level 34
public abstract F[] parameterArray ()

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

Returns
F[] field descriptors for the parameter types

parameterCount

Added in API level 34
public abstract int parameterCount ()

Return the number of parameters in the method type

Returns
int the number of parameters

parameterList

Added in API level 34
public abstract List<F> parameterList ()

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

Returns
List<F> field descriptors for the parameter types

parameterType

Added in API level 34
public abstract F parameterType (int i)

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

Parameters
i int: the index of the parameter

Returns
F a field descriptor for the requested parameter type

Throws
IndexOutOfBoundsException if the index is outside the half-open range {[0, parameterCount)}

returnType

Added in API level 34
public abstract F returnType ()

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

Returns
F a field descriptor for the return type