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
Method descriptors conforming to JVMS 4.3.3 can be described
nominally via
MethodType::describeConstable
;
otherwise they cannot be described nominally.- 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 TypeMethodDescriptionchangeParameterType
(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.changeReturnType
(F newReturn) Return a method descriptor that is identical to this one, except that the return type has been changed to the specified typedropParameterTypes
(int start, int end) Return a method descriptor that is identical to this one, except that a range of parameter types have been removed.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.F[]
Return an array of field descriptors for the parameter types of the method type described by this descriptorint
Return the number of parameters in the method typeReturn an immutable list of field descriptors for the parameter types of the method type described by this descriptorparameterType
(int i) Return a field descriptor describing the requested parameter of the method type described by this descriptorReturn a field descriptor describing the return type of the method type described by this descriptorMethods declared in interface java.lang.invoke.TypeDescriptor
descriptorString
-
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
-
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 isnull
IndexOutOfBoundsException
- 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
- ifstart
is outside the half-open range[0, parameterCount)
, orend
is 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 isnull
IndexOutOfBoundsException
- ifpos
is outside the closed range {[0, parameterCount]}
-