public class ConstructorDeclaration extends CallableDeclaration<ConstructorDeclaration> implements NodeWithBlockStmt<ConstructorDeclaration>, NodeWithAccessModifiers<ConstructorDeclaration>, NodeWithJavadoc<ConstructorDeclaration>, NodeWithSimpleName<ConstructorDeclaration>, NodeWithParameters<ConstructorDeclaration>, NodeWithThrownExceptions<ConstructorDeclaration>, NodeWithTypeParameters<ConstructorDeclaration>, Resolvable<ResolvedConstructorDeclaration>
class X { X() { } } where X(){} is the constructor declaration.
All annotations preceding the name will be set on this object, not on the class.
JavaParser doesn't know if it they are applicable to the method or the class.
CallableDeclaration.SignatureNode.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversalABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration, SYMBOL_RESOLVER_KEYappendThrowsIfRequested, asCallableDeclaration, getDeclarationAsString, getDeclarationAsString, getModifiers, getName, getParameters, getReceiverParameter, getSignature, getThrownExceptions, getTypeParameters, ifCallableDeclaration, isCallableDeclaration, removeReceiverParameter, setReceiverParameter, toCallableDeclarationasAnnotationDeclaration, asAnnotationMemberDeclaration, asClassOrInterfaceDeclaration, asEnumConstantDeclaration, asEnumDeclaration, asFieldDeclaration, asInitializerDeclaration, asMethodDeclaration, asTypeDeclaration, getAnnotations, ifAnnotationDeclaration, ifAnnotationMemberDeclaration, ifClassOrInterfaceDeclaration, ifEnumConstantDeclaration, ifEnumDeclaration, ifFieldDeclaration, ifInitializerDeclaration, ifMethodDeclaration, ifTypeDeclaration, isAnnotationDeclaration, isAnnotationMemberDeclaration, isClassOrInterfaceDeclaration, isEnumConstantDeclaration, isEnumDeclaration, isFieldDeclaration, isInitializerDeclaration, isMethodDeclaration, isTypeDeclaration, setAnnotations, toAnnotationDeclaration, toAnnotationMemberDeclaration, toClassOrInterfaceDeclaration, toEnumConstantDeclaration, toEnumDeclaration, toFieldDeclaration, toInitializerDeclaration, toMethodDeclaration, toTypeDeclarationaddOrphanComment, containsData, customInitialization, equals, findAll, findAll, findCompilationUnit, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getSymbolResolver, getTokenRange, getToStringPrettyPrinterConfiguration, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, setToStringPrettyPrinterConfiguration, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walkfinalize, getClass, notify, notifyAll, wait, wait, waitcreateBodyisPublic, setPublicisPrivate, setPrivateisProtected, setProtectedaddModifier, getAccessSpecifier, getModifiers, hasModifier, removeModifier, setModifier, setModifiersgetComment, getJavadoc, getJavadocComment, hasJavaDocComment, removeJavaDocComment, setComment, setJavadocComment, setJavadocComment, setJavadocComment, setJavadocCommentgetName, getNameAsExpression, getNameAsString, setNameaddAndGetParameter, addAndGetParameter, addAndGetParameter, addAndGetParameter, addParameter, addParameter, addParameter, addParameter, getParameter, getParameterByName, getParameterByType, getParameterByType, getParameters, hasParametersOfType, hasParametersOfType, setParameter, tryAddImportToParentCompilationUnitaddThrownException, addThrownException, getThrownException, getThrownExceptions, isThrown, isThrown, tryAddImportToParentCompilationUnitaddTypeParameter, addTypeParameter, getTypeParameter, getTypeParameters, isGeneric, setTypeParameterisAbstract, setAbstractisStatic, setStaticisFinal, setFinalisStrictfp, setStrictfpaddAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnitfindAncestor, findAncestorcontainsWithin, getBegin, getEndpublic ConstructorDeclaration()
public ConstructorDeclaration(String name)
public ConstructorDeclaration(NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions, BlockStmt body)
public ConstructorDeclaration(NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions, BlockStmt body, ReceiverParameter receiverParameter)
public ConstructorDeclaration(TokenRange tokenRange, NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions, BlockStmt body, ReceiverParameter receiverParameter)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitableaccept in interface VisitableR - the type of the return value of the visitorA - the type the user argument passed to the visitorv - the visitor implementationarg - the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitablepublic BlockStmt getBody()
getBody in interface NodeWithBlockStmt<ConstructorDeclaration>public ConstructorDeclaration setBody(BlockStmt body)
setBody in interface NodeWithBlockStmt<ConstructorDeclaration>body - the body, can not be nullpublic ConstructorDeclaration setModifiers(NodeList<Modifier> modifiers)
setModifiers in interface NodeWithModifiers<ConstructorDeclaration>setModifiers in class CallableDeclaration<ConstructorDeclaration>public ConstructorDeclaration setName(SimpleName name)
setName in interface NodeWithSimpleName<ConstructorDeclaration>setName in class CallableDeclaration<ConstructorDeclaration>public ConstructorDeclaration setParameters(NodeList<Parameter> parameters)
setParameters in interface NodeWithParameters<ConstructorDeclaration>setParameters in class CallableDeclaration<ConstructorDeclaration>public ConstructorDeclaration setThrownExceptions(NodeList<ReferenceType> thrownExceptions)
setThrownExceptions in interface NodeWithThrownExceptions<ConstructorDeclaration>setThrownExceptions in class CallableDeclaration<ConstructorDeclaration>public ConstructorDeclaration setTypeParameters(NodeList<TypeParameter> typeParameters)
setTypeParameters in interface NodeWithTypeParameters<ConstructorDeclaration>setTypeParameters in class CallableDeclaration<ConstructorDeclaration>public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName)
[accessSpecifier] className ([paramType [paramName]]) [throws exceptionsList]
getDeclarationAsString in interface NodeWithDeclarationgetDeclarationAsString in class CallableDeclaration<ConstructorDeclaration>includingModifiers - flag to include the modifiers (if present) in the string producedincludingThrows - flag to include the throws clause (if present) in the string producedincludingParameterName - flag to include the parameter name (while the parameter type is always included) in
the string producedpublic boolean remove(Node node)
remove in class CallableDeclaration<ConstructorDeclaration>public ConstructorDeclaration clone()
clone in class CallableDeclaration<ConstructorDeclaration>public ConstructorDeclarationMetaModel getMetaModel()
getMetaModel in class CallableDeclaration<ConstructorDeclaration>public boolean replace(Node node, Node replacementNode)
replace in class CallableDeclaration<ConstructorDeclaration>public boolean isConstructorDeclaration()
isConstructorDeclaration in class BodyDeclaration<ConstructorDeclaration>public ConstructorDeclaration asConstructorDeclaration()
asConstructorDeclaration in class BodyDeclaration<ConstructorDeclaration>public void ifConstructorDeclaration(Consumer<ConstructorDeclaration> action)
ifConstructorDeclaration in class BodyDeclaration<ConstructorDeclaration>public ResolvedConstructorDeclaration resolve()
resolve in interface Resolvable<ResolvedConstructorDeclaration>public Optional<ConstructorDeclaration> toConstructorDeclaration()
toConstructorDeclaration in class BodyDeclaration<ConstructorDeclaration>Copyright © 2007–2019. All rights reserved.