Top Description Methods
com.github.javaparser.resolution.declarations

public Interface ResolvedMethodLikeDeclaration

extends ResolvedDeclaration, ResolvedTypeParametrizable, HasAccessSpecifier
Known Direct Subinterfaces
com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration, com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration
Imports
com.github.javaparser.resolution.types.ResolvedType, java.util.Collections, .LinkedList, .List, .Optional

This is a common interface for MethodDeclaration and ConstructorDeclaration.
Author
Federico Tomassetti

Method Summary

Modifier and TypeMethod and Description
public ResolvedReferenceTypeDeclaration
declaringType()

The type in which the method is declared.

public default Optional<ResolvedTypeParameterDeclaration>
findTypeParameter(String name)

Implements com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable.findTypeParameter.

Find the closest TypeParameterDeclaration with the given name.
public default String
getClassName()

The class(es) wrapping the declaring type.

public default ResolvedParameterDeclaration
getLastParam()

Utility method to get the last ParameterDeclaration.

public int
getNumberOfParams()

Number of params.

public int
getNumberOfSpecifiedExceptions()

Number of exceptions listed in the throws clause.

public default String
getPackageName()

The package name of the declaring type.

public ResolvedParameterDeclaration
getParam(int i)

Get the ParameterDeclaration at the corresponding position or throw IllegalArgumentException.

public default String
getQualifiedName()

The qualified name of the method composed by the qualfied name of the declaring type followed by a dot and the name of the method.

public default String
getQualifiedSignature()

The qualified signature of the method.

public default String
getSignature()

The signature of the method.

public ResolvedType
getSpecifiedException(int index)

Type of the corresponding entry in the throws clause.

public default List<ResolvedType>
public default boolean
hasVariadicParameter()

Has the method or construcor a variadic parameter?

Inherited from com.github.javaparser.resolution.declarations.HasAccessSpecifier:
accessSpecifier
Inherited from com.github.javaparser.resolution.declarations.ResolvedDeclaration:
asEnumConstantasFieldasMethodasParameterasTypegetNamehasNameisEnumConstantisFieldisMethodisParameterisTypeisVariable
Inherited from com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable:
getTypeParametersisGeneric

Method Detail

declaringTypeback to summary
public ResolvedReferenceTypeDeclaration declaringType()

The type in which the method is declared.

findTypeParameterback to summary
public default Optional<ResolvedTypeParameterDeclaration> findTypeParameter(String name)

Implements com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable.findTypeParameter.

Doc from com.github.javaparser.resolution.declarations.ResolvedTypeParametrizable.findTypeParameter.

Find the closest TypeParameterDeclaration with the given name. It first look on this element itself and then on the containers.

Annotations
@Override
getClassNameback to summary
public default String getClassName()

The class(es) wrapping the declaring type.

getLastParamback to summary
public default ResolvedParameterDeclaration getLastParam()

Utility method to get the last ParameterDeclaration. It throws UnsupportedOperationException if the method has no parameters. The last parameter can be variadic and sometimes it needs to be handled in a special way.

getNumberOfParamsback to summary
public int getNumberOfParams()

Number of params.

getNumberOfSpecifiedExceptionsback to summary
public int getNumberOfSpecifiedExceptions()

Number of exceptions listed in the throws clause.

getPackageNameback to summary
public default String getPackageName()

The package name of the declaring type.

getParamback to summary
public ResolvedParameterDeclaration getParam(int i)

Get the ParameterDeclaration at the corresponding position or throw IllegalArgumentException.

getQualifiedNameback to summary
public default String getQualifiedName()

The qualified name of the method composed by the qualfied name of the declaring type followed by a dot and the name of the method.

getQualifiedSignatureback to summary
public default String getQualifiedSignature()

The qualified signature of the method. It is composed by the qualified name of the declaring type followed by the signature of the method.

getSignatureback to summary
public default String getSignature()

The signature of the method.

getSpecifiedExceptionback to summary
public ResolvedType getSpecifiedException(int index)

Type of the corresponding entry in the throws clause.

Exceptions
IllegalArgumentException:
if the index is negative or it is equal or greater than the value returned by getNumberOfSpecifiedExceptions
UnsupportedOperationException:
for those types of methods of constructor that do not declare exceptions
getSpecifiedExceptionsback to summary
public default List<ResolvedType> getSpecifiedExceptions()
hasVariadicParameterback to summary
public default boolean hasVariadicParameter()

Has the method or construcor a variadic parameter? Note that when a method has a variadic parameter it should have an array type.