ConstantDesc
, TypeDescriptor
, TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
public interface MethodTypeDesc extends ConstantDesc, TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
Two MethodTypeDesc objects are considered Object.equals(Object)
if they have the same arity, their return types are equal, and each pair of corresponding
parameter types are equal.
TypeDescriptor.OfField<F extends TypeDescriptor.OfField<F>>, TypeDescriptor.OfMethod<F extends TypeDescriptor.OfField<F>,M extends TypeDescriptor.OfMethod<F,M>>
Modifier and Type | Method | Description |
---|---|---|
MethodTypeDesc |
changeParameterType(int index,
ClassDesc paramType) |
Return a MethodTypeDesc that is identical to this one,
except that a single parameter type has been changed to the specified type.
|
MethodTypeDesc |
changeReturnType(ClassDesc returnType) |
Return a MethodTypeDesc that is identical to
this one, except with the specified return type.
|
default String |
descriptorString() |
Return the method type descriptor string
|
default String |
displayDescriptor() |
Return a human-readable descriptor for this method type, using the
canonical names for parameter and return types
|
MethodTypeDesc |
dropParameterTypes(int start,
int end) |
Return a MethodTypeDesc that is identical to this one,
except that a range of parameter types have been removed.
|
MethodTypeDesc |
insertParameterTypes(int pos,
ClassDesc... paramTypes) |
Return a MethodTypeDesc that is identical to this one,
except that a range of additional parameter types have been inserted.
|
static MethodTypeDesc |
of(ClassDesc returnDesc,
ClassDesc... paramDescs) |
Returns a MethodTypeDesc given the return type and parameter
types.
|
static MethodTypeDesc |
ofDescriptor(String descriptor) |
Create a MethodTypeDesc given a method descriptor string
|
ClassDesc[] |
parameterArray() |
Get the parameter types as an array.
|
int |
parameterCount() |
Get the number of parameters of the method type described by
this MethodTypeDesc
|
java.util.List<ClassDesc> |
parameterList() |
Get the parameter types as an immutable
List . |
ClassDesc |
parameterType(int index) |
Get the parameter type of the
index 'th parameter of the method type
described by this MethodTypeDesc |
ClassDesc |
returnType() |
Get the return type of the method type described by this MethodTypeDesc
|
resolveConstantDesc
static MethodTypeDesc ofDescriptor(String descriptor)
descriptor
- a method descriptor stringNullPointerException
- if any argument is null
IllegalArgumentException
- if the descriptor string is not a valid
method descriptorstatic MethodTypeDesc of(ClassDesc returnDesc, ClassDesc... paramDescs)
returnDesc
- a ClassDesc describing the return typeparamDescs
- ClassDescs describing the argument typesNullPointerException
- if any argument is null
ClassDesc returnType()
returnType
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
ClassDesc
describing the return type of the method typeint parameterCount()
parameterCount
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
ClassDesc parameterType(int index)
index
'th parameter of the method type
described by this MethodTypeDescparameterType
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
index
- the index of the parameter to retrieveClassDesc
describing the desired parameter typeIndexOutOfBoundsException
- if the index is outside the half-open
range {[0, parameterCount())}java.util.List<ClassDesc> parameterList()
List
.parameterList
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
List
of ClassDesc
describing the parameter typesClassDesc[] parameterArray()
parameterArray
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
ClassDesc
describing the parameter typesMethodTypeDesc changeReturnType(ClassDesc returnType)
changeReturnType
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
returnType
- a ClassDesc
describing the new return typeNullPointerException
- if any argument is null
MethodTypeDesc changeParameterType(int index, ClassDesc paramType)
changeParameterType
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
index
- the index of the parameter to changeparamType
- a ClassDesc
describing the new parameter typeNullPointerException
- if any argument is null
IndexOutOfBoundsException
- if the index is outside the half-open
range {[0, parameterCount)}MethodTypeDesc dropParameterTypes(int start, int end)
dropParameterTypes
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
start
- the index of the first parameter to removeend
- the index after the last parameter to removeIndexOutOfBoundsException
- if start
is outside the half-open
range {[0, parameterCount)}, or end
is outside the closed range
[0, parameterCount]
MethodTypeDesc insertParameterTypes(int pos, ClassDesc... paramTypes)
insertParameterTypes
in interface TypeDescriptor.OfMethod<ClassDesc,MethodTypeDesc>
pos
- the index at which to insert the first inserted parameterparamTypes
- ClassDesc
s describing the new parameter types
to insertNullPointerException
- if any argument is null
IndexOutOfBoundsException
- if pos
is outside the closed
range {[0, parameterCount]}default String descriptorString()
descriptorString
in interface TypeDescriptor
default String displayDescriptor()