TypeDescriptor.OfMethod  |  API reference  |  Android Developers

public static interface TypeDescriptor.OfMethod
implements TypeDescriptor

Known indirect subclasses

MethodType A method type represents the arguments and return type accepted and returned by a method handle, or the arguments and return type passed and expected by a method handle caller. 


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

From interface java.lang.invoke.TypeDescriptor

abstract String descriptorString()

Returns the descriptor string for this TypeDescriptor object.

Public methods

changeParameterType

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
IndexOutOfBoundsException if the index is outside the half-open range {[0, parameterCount)}
NullPointerException if any argument is null

changeReturnType

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

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

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
IndexOutOfBoundsException if pos is outside the closed range {[0, parameterCount]}
NullPointerException if any argument is null

parameterArray

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

public abstract int parameterCount ()

Return the number of parameters in the method type

Returns
int the number of parameters

parameterList

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

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

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