Module java.base
Package java.lang.invoke
Interface TypeDescriptor.OfMethod<F extends TypeDescriptor.OfField<F>,M extends TypeDescriptor.OfMethod<F,M>>
- Type Parameters:
F- the type representing field type descriptorsM- the class implementing TypeDescriptor.OfMethod
- All Superinterfaces:
TypeDescriptor
- All Known Subinterfaces:
MethodTypeDesc
- All Known Implementing Classes:
MethodType
- Enclosing interface:
- TypeDescriptor
public static interface TypeDescriptor.OfMethod<F extends TypeDescriptor.OfField<F>,M extends TypeDescriptor.OfMethod<F,M>> extends TypeDescriptor
An entity that has a method type descriptor
- See Java Virtual Machine Specification:
-
4.3.2 Field Descriptors
4.3.3 Method Descriptors - Since:
- 12
-
Nested Class Summary
Nested classes/interfaces declared in interface java.lang.invoke.TypeDescriptor
TypeDescriptor.OfField<F extends TypeDescriptor.OfField<F>>, TypeDescriptor.OfMethod<F extends TypeDescriptor.OfField<F>,M extends TypeDescriptor.OfMethod<F,M>> -
Method Summary
Modifier and Type Method Description MchangeParameterType(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.MchangeReturnType(F newReturn)Return a method descriptor that is identical to this one, except that the return type has been changed to the specified typeMdropParameterTypes(int start, int end)Return a method descriptor that is identical to this one, except that a range of parameter types have been removed.MinsertParameterTypes(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.F[]parameterArray()Return an array of field descriptors for the parameter types of the method type described by this descriptorintparameterCount()Return the number of parameters in the method typeList<F>parameterList()Return an immutable list of field descriptors for the parameter types of the method type described by this descriptorFparameterType(int i)Return a field descriptor describing the requested parameter of the method type described by this descriptorFreturnType()Return a field descriptor describing the return type of the method type described by this descriptor
-
Method Details
-
parameterCount
int parameterCount()Return the number of parameters in the method type- Returns:
- the number of parameters
-
parameterType
Return a field descriptor describing the requested parameter of the method type described by this descriptor- Parameters:
i- the index of the parameter- Returns:
- a field descriptor for the requested parameter type
- Throws:
IndexOutOfBoundsException- if the index is outside the half-open range {[0, parameterCount)}
-
returnType
F returnType()Return a field descriptor describing the return type of the method type described by this descriptor- Returns:
- a field descriptor for the return type
-
parameterArray
F[] parameterArray()Return an array of field descriptors for the parameter types of the method type described by this descriptor- Returns:
- field descriptors for the parameter types
-
parameterList
Return an immutable list of field descriptors for the parameter types of the method type described by this descriptor- Returns:
- field descriptors for the parameter types
-
changeReturnType
Return a method descriptor that is identical to this one, except that the return type has been changed to the specified type- Parameters:
newReturn- a field descriptor for the new return type- Returns:
- the new method descriptor
- Throws:
NullPointerException- if any argument isnull
-
changeParameterType
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- the index of the parameter to changeparamType- a field descriptor describing the new parameter type- Returns:
- the new method descriptor
- Throws:
NullPointerException- if any argument isnullIndexOutOfBoundsException- if the index is outside the half-open range {[0, parameterCount)}
-
dropParameterTypes
Return a method descriptor that is identical to this one, except that a range of parameter types have been removed.- Parameters:
start- the index of the first parameter to removeend- the index after the last parameter to remove- Returns:
- the new method descriptor
- Throws:
IndexOutOfBoundsException- ifstartis outside the half-open range[0, parameterCount), orendis outside the closed range[0, parameterCount], or ifstart > end
-
insertParameterTypes
Return a method descriptor that is identical to this one, except that a range of additional parameter types have been inserted.- Parameters:
pos- the index at which to insert the first inserted parameterparamTypes- field descriptors describing the new parameter types to insert- Returns:
- the new method descriptor
- Throws:
NullPointerException- if any argument isnullIndexOutOfBoundsException- ifposis outside the closed range {[0, parameterCount]}
-