- All Superinterfaces:
- ConstantDesc,- TypeDescriptor,- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
public interface MethodTypeDesc extends ConstantDesc, TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
A nominal descriptor for a
 MethodType constant.
- API Note:
- In the future, if the Java language permits, MethodTypeDesc
 may become a sealedinterface, which would prohibit subclassing except by explicitly permitted types. Non-platform classes should not implement MethodTypeDesc directly.
- Since:
- 12
- 
Nested Class SummaryNested classes/interfaces declared in interface java.lang.invoke.TypeDescriptorTypeDescriptor.OfField<F extends TypeDescriptor.OfField<F>>, TypeDescriptor.OfMethod<F extends TypeDescriptor.OfField<F>,M extends TypeDescriptor.OfMethod<F,M>>
- 
Method SummaryModifier and Type Method Description MethodTypeDescchangeParameterType(int index, ClassDesc paramType)Returns a MethodTypeDesc that is identical to this one, except that a single parameter type has been changed to the specified type.MethodTypeDescchangeReturnType(ClassDesc returnType)Returns a MethodTypeDesc that is identical to this one, except with the specified return type.default StringdescriptorString()Returns the method type descriptor string.default StringdisplayDescriptor()Returns a human-readable descriptor for this method type, using the canonical names for parameter and return types.MethodTypeDescdropParameterTypes(int start, int end)Returns a MethodTypeDesc that is identical to this one, except that a range of parameter types have been removed.booleanequals(Object o)Compares the specified object with this descriptor for equality.MethodTypeDescinsertParameterTypes(int pos, ClassDesc... paramTypes)Returns a MethodTypeDesc that is identical to this one, except that a range of additional parameter types have been inserted.static MethodTypeDescof(ClassDesc returnDesc, ClassDesc... paramDescs)Returns a MethodTypeDesc given the return type and parameter types.static MethodTypeDescofDescriptor(String descriptor)Creates a MethodTypeDesc given a method descriptor string.ClassDesc[]parameterArray()Returns the parameter types as an array.intparameterCount()Returns the number of parameters of the method type described by this MethodTypeDesc.List<ClassDesc>parameterList()Returns the parameter types as an immutableList.ClassDescparameterType(int index)Returns the parameter type of theindex'th parameter of the method type described by this MethodTypeDesc.ClassDescreturnType()Gets the return type of the method type described by this MethodTypeDesc.
- 
Method Details- 
ofDescriptorCreates a MethodTypeDesc given a method descriptor string.- Parameters:
- descriptor- a method descriptor string
- Returns:
- a MethodTypeDesc describing the desired method type
- Throws:
- NullPointerException- if the argument is- null
- IllegalArgumentException- if the descriptor string is not a valid method descriptor
- See Java Virtual Machine Specification:
- 
4.3.3 Method Descriptors
 
- 
ofReturns a MethodTypeDesc given the return type and parameter types.- Parameters:
- returnDesc- a ClassDesc describing the return type
- paramDescs- ClassDescs describing the argument types
- Returns:
- a MethodTypeDesc describing the desired method type
- Throws:
- NullPointerException- if any argument or its contents are- null
- IllegalArgumentException- if any element of- paramDescsis a- ClassDescfor- void
 
- 
returnTypeClassDesc returnType()Gets the return type of the method type described by this MethodTypeDesc.- Specified by:
- returnTypein interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Returns:
- a ClassDescdescribing the return type of the method type
 
- 
parameterCountint parameterCount()Returns the number of parameters of the method type described by this MethodTypeDesc.- Specified by:
- parameterCountin interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Returns:
- the number of parameters
 
- 
parameterTypeReturns the parameter type of theindex'th parameter of the method type described by this MethodTypeDesc.- Specified by:
- parameterTypein interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Parameters:
- index- the index of the parameter to retrieve
- Returns:
- a ClassDescdescribing the desired parameter type
- Throws:
- IndexOutOfBoundsException- if the index is outside the half-open range {[0, parameterCount())}
 
- 
parameterListReturns the parameter types as an immutableList.- Specified by:
- parameterListin interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Returns:
- a ListofClassDescdescribing the parameter types
 
- 
parameterArrayClassDesc[] parameterArray()Returns the parameter types as an array.- Specified by:
- parameterArrayin interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Returns:
- an array of ClassDescdescribing the parameter types
 
- 
changeReturnTypeReturns a MethodTypeDesc that is identical to this one, except with the specified return type.- Specified by:
- changeReturnTypein interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Parameters:
- returnType- a- ClassDescdescribing the new return type
- Returns:
- a MethodTypeDesc describing the desired method type
- Throws:
- NullPointerException- if the argument is- null
 
- 
changeParameterTypeReturns a MethodTypeDesc that is identical to this one, except that a single parameter type has been changed to the specified type.- Specified by:
- changeParameterTypein interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Parameters:
- index- the index of the parameter to change
- paramType- a- ClassDescdescribing the new parameter type
- Returns:
- a MethodTypeDesc describing the desired method type
- Throws:
- NullPointerException- if any argument is- null
- IndexOutOfBoundsException- if the index is outside the half-open range {[0, parameterCount)}
 
- 
dropParameterTypesReturns a MethodTypeDesc that is identical to this one, except that a range of parameter types have been removed.- Specified by:
- dropParameterTypesin interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Parameters:
- start- the index of the first parameter to remove
- end- the index after the last parameter to remove
- Returns:
- a MethodTypeDesc describing the desired method type
- Throws:
- IndexOutOfBoundsException- if- startis outside the half-open range- [0, parameterCount), or- endis outside the closed range- [0, parameterCount], or if- start > end
 
- 
insertParameterTypesReturns a MethodTypeDesc that is identical to this one, except that a range of additional parameter types have been inserted.- Specified by:
- insertParameterTypesin interface- TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
- Parameters:
- pos- the index at which to insert the first inserted parameter
- paramTypes-- ClassDescs describing the new parameter types to insert
- Returns:
- a MethodTypeDesc describing the desired method type
- Throws:
- NullPointerException- if any argument or its contents are- null
- IndexOutOfBoundsException- if- posis outside the closed range {[0, parameterCount]}
- IllegalArgumentException- if any element of- paramTypesis a- ClassDescfor- void
 
- 
descriptorStringReturns the method type descriptor string.- Specified by:
- descriptorStringin interface- TypeDescriptor
- Returns:
- the method type descriptor string
- See Java Virtual Machine Specification:
- 
4.3.3 Method Descriptors
 
- 
displayDescriptorReturns a human-readable descriptor for this method type, using the canonical names for parameter and return types.- Returns:
- the human-readable descriptor for this method type
 
- 
equalsCompares the specified object with this descriptor for equality. Returnstrueif and only if the specified object is also a MethodTypeDesc both have the same arity, their return types are equal, and each pair of corresponding parameter types are equal.- Overrides:
- equalsin class- Object
- Parameters:
- o- the other object
- Returns:
- whether this descriptor is equal to the other object
- See Also:
- Object.hashCode(),- HashMap
 
 
-