Class JavassistMethodDeclaration
- java.lang.Object
-
- com.github.javaparser.symbolsolver.javassistmodel.JavassistMethodDeclaration
-
- All Implemented Interfaces:
AssociableToAST
,HasAccessSpecifier
,ResolvedDeclaration
,ResolvedMethodDeclaration
,ResolvedMethodLikeDeclaration
,ResolvedTypeParametrizable
,TypeVariableResolutionCapability
public class JavassistMethodDeclaration extends java.lang.Object implements ResolvedMethodDeclaration, TypeVariableResolutionCapability
-
-
Field Summary
Fields Modifier and Type Field Description private javassist.CtMethod
ctMethod
private JavassistMethodLikeDeclarationAdapter
methodLikeAdaper
private TypeSolver
typeSolver
-
Constructor Summary
Constructors Constructor Description JavassistMethodDeclaration(javassist.CtMethod ctMethod, TypeSolver typeSolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessSpecifier
accessSpecifier()
The access specifier of this element.ResolvedReferenceTypeDeclaration
declaringType()
The type in which the method is declared.java.lang.String
getName()
Should return the name or return null if the name is not available.int
getNumberOfParams()
Number of params.int
getNumberOfSpecifiedExceptions()
Number of exceptions listed in the throws clause.ResolvedParameterDeclaration
getParam(int i)
Get the ParameterDeclaration at the corresponding position or throw IllegalArgumentException.ResolvedType
getReturnType()
The type of the value returned by the current method.ResolvedType
getSpecifiedException(int index)
Type of the corresponding entry in the throws clause.java.util.List<ResolvedTypeParameterDeclaration>
getTypeParameters()
The list of type parameters defined on this element.MethodUsage
getUsage(Node node)
boolean
isAbstract()
Is the method abstract? All interface methods not marked as default are abstract.boolean
isDefaultMethod()
Is this a default method?boolean
isField()
Does this declaration represents a class field?boolean
isParameter()
Does this declaration represents a method parameter?boolean
isStatic()
boolean
isType()
Does this declaration represents a type?MethodUsage
resolveTypeVariables(Context context, java.util.List<ResolvedType> parameterTypes)
java.lang.String
toDescriptor()
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.resolution.declarations.AssociableToAST
toAst, toAst
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedDeclaration
asEnumConstant, asField, asMethod, asParameter, asType, asTypePattern, hasName, isEnumConstant, isMethod, isTypePattern, isVariable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration
isReturnTypeSubstituable
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedMethodLikeDeclaration
findTypeParameter, formalParameterTypes, getClassName, getLastParam, getPackageName, getQualifiedName, getQualifiedSignature, getSignature, getSpecifiedExceptions, hasVariadicParameter
-
Methods inherited from interface com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable
isGeneric
-
-
-
-
Field Detail
-
ctMethod
private javassist.CtMethod ctMethod
-
typeSolver
private TypeSolver typeSolver
-
methodLikeAdaper
private final JavassistMethodLikeDeclarationAdapter methodLikeAdaper
-
-
Constructor Detail
-
JavassistMethodDeclaration
public JavassistMethodDeclaration(javassist.CtMethod ctMethod, TypeSolver typeSolver)
-
-
Method Detail
-
isDefaultMethod
public boolean isDefaultMethod()
Description copied from interface:ResolvedMethodDeclaration
Is this a default method?- Specified by:
isDefaultMethod
in interfaceResolvedMethodDeclaration
-
isStatic
public boolean isStatic()
- Specified by:
isStatic
in interfaceResolvedMethodDeclaration
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()
Description copied from interface:ResolvedDeclaration
Should return the name or return null if the name is not available.- Specified by:
getName
in interfaceResolvedDeclaration
-
isField
public boolean isField()
Description copied from interface:ResolvedDeclaration
Does this declaration represents a class field?- Specified by:
isField
in interfaceResolvedDeclaration
-
isParameter
public boolean isParameter()
Description copied from interface:ResolvedDeclaration
Does this declaration represents a method parameter?- Specified by:
isParameter
in interfaceResolvedDeclaration
-
isType
public boolean isType()
Description copied from interface:ResolvedDeclaration
Does this declaration represents a type?- Specified by:
isType
in interfaceResolvedDeclaration
-
declaringType
public ResolvedReferenceTypeDeclaration declaringType()
Description copied from interface:ResolvedMethodLikeDeclaration
The type in which the method is declared.- Specified by:
declaringType
in interfaceResolvedMethodLikeDeclaration
-
getReturnType
public ResolvedType getReturnType()
Description copied from interface:ResolvedMethodDeclaration
The type of the value returned by the current method. This method can also be invoked for methods returning void.- Specified by:
getReturnType
in interfaceResolvedMethodDeclaration
-
getNumberOfParams
public int getNumberOfParams()
Description copied from interface:ResolvedMethodLikeDeclaration
Number of params.- Specified by:
getNumberOfParams
in interfaceResolvedMethodLikeDeclaration
-
getParam
public ResolvedParameterDeclaration getParam(int i)
Description copied from interface:ResolvedMethodLikeDeclaration
Get the ParameterDeclaration at the corresponding position or throw IllegalArgumentException.- Specified by:
getParam
in interfaceResolvedMethodLikeDeclaration
-
getUsage
public MethodUsage getUsage(Node node)
-
resolveTypeVariables
public MethodUsage resolveTypeVariables(Context context, java.util.List<ResolvedType> parameterTypes)
- Specified by:
resolveTypeVariables
in interfaceTypeVariableResolutionCapability
-
isAbstract
public boolean isAbstract()
Description copied from interface:ResolvedMethodDeclaration
Is the method abstract? All interface methods not marked as default are abstract.- Specified by:
isAbstract
in interfaceResolvedMethodDeclaration
-
getTypeParameters
public java.util.List<ResolvedTypeParameterDeclaration> getTypeParameters()
Description copied from interface:ResolvedTypeParametrizable
The list of type parameters defined on this element.- Specified by:
getTypeParameters
in interfaceResolvedTypeParametrizable
-
accessSpecifier
public AccessSpecifier accessSpecifier()
Description copied from interface:HasAccessSpecifier
The access specifier of this element.- Specified by:
accessSpecifier
in interfaceHasAccessSpecifier
-
getNumberOfSpecifiedExceptions
public int getNumberOfSpecifiedExceptions()
Description copied from interface:ResolvedMethodLikeDeclaration
Number of exceptions listed in the throws clause.- Specified by:
getNumberOfSpecifiedExceptions
in interfaceResolvedMethodLikeDeclaration
-
getSpecifiedException
public ResolvedType getSpecifiedException(int index)
Description copied from interface:ResolvedMethodLikeDeclaration
Type of the corresponding entry in the throws clause.- Specified by:
getSpecifiedException
in interfaceResolvedMethodLikeDeclaration
-
toDescriptor
public java.lang.String toDescriptor()
- Specified by:
toDescriptor
in interfaceResolvedMethodDeclaration
-
-