Class JavaParserParameterDeclaration
java.lang.Object
com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserParameterDeclaration
- All Implemented Interfaces:
AssociableToAST, ResolvedDeclaration, ResolvedParameterDeclaration, ResolvedValueDeclaration
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJavaParserParameterDeclaration(Parameter wrappedNode, TypeSolver typeSolver) -
Method Summary
Modifier and TypeMethodDescriptiongetName()Should return the name or return null if the name is not available.getType()Type of the declaration.Returns the JavaParser node associated with this JavaParserParameterDeclaration.booleanIs this parameter declared as variadic?toAst()If the declaration is associated to an AST node return it, otherwise it return empty.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AssociableToAST
toAstMethods inherited from interface ResolvedDeclaration
asEnumConstant, asField, asMethod, asType, asTypePattern, isEnumConstant, isField, isMethod, isType, isTypePattern, isVariableMethods inherited from interface ResolvedParameterDeclaration
asParameter, describeType, hasName, isParameter
-
Field Details
-
wrappedNode
-
typeSolver
-
-
Constructor Details
-
JavaParserParameterDeclaration
-
-
Method Details
-
getName
Description copied from interface:ResolvedDeclarationShould return the name or return null if the name is not available.- Specified by:
getNamein interfaceResolvedDeclaration
-
isVariadic
public boolean isVariadic()Description copied from interface:ResolvedParameterDeclarationIs this parameter declared as variadic?- Specified by:
isVariadicin interfaceResolvedParameterDeclaration
-
getType
Description copied from interface:ResolvedValueDeclarationType of the declaration.- Specified by:
getTypein interfaceResolvedValueDeclaration
-
getWrappedNode
Returns the JavaParser node associated with this JavaParserParameterDeclaration.- Returns:
- A visitable JavaParser node wrapped by this object.
-
toAst
Description copied from interface:AssociableToASTIf the declaration is associated to an AST node return it, otherwise it return empty. Declaration based on source code have an AST node associated while others don't. Example of other declarations are declarations coming from reflection or JARs. You may wonder how this method is different from the various getWrappedNode. The difference is that toAst is present in all Resolved* declarations (such as ResolvedAnnotationDeclaration), while getWrappedNode is present only on the subclasses of the Resolved* declarations that derive from JP AST nodes (such as JavaParserClassDeclaration). Therefore one which has a Resolved* declaration need to do a downcast before being able to use getWrappedNode. Now, this means that toAst could potentially replace getWrappedNode (but not the other way around!). However toAst return an Optional, which is less convenient than getting the direct node. Also, toAst sometimes have to return a more generic node. This is the case for subclasses of ResolvedClassDeclaration. In those cases toAst return a Node. Why? Because both anonymous class declarations and standard class declarations are subclasses of that. In one case the underlying AST node is an ObjectCreationExpr, while in the other case it is ClassOrInterfaceDeclaration. In these cases getWrappedNode is particularly nice because it returns the right type of AST node, not just a Node.- Specified by:
toAstin interfaceAssociableToAST
-