NodeWithAbstractModifier<ConstructorDeclaration>
, NodeWithAccessModifiers<ConstructorDeclaration>
, NodeWithFinalModifier<ConstructorDeclaration>
, NodeWithPrivateModifier<ConstructorDeclaration>
, NodeWithProtectedModifier<ConstructorDeclaration>
, NodeWithPublicModifier<ConstructorDeclaration>
, NodeWithStaticModifier<ConstructorDeclaration>
, NodeWithStrictfpModifier<ConstructorDeclaration>
, NodeWithAnnotations<ConstructorDeclaration>
, NodeWithBlockStmt<ConstructorDeclaration>
, NodeWithDeclaration
, NodeWithJavadoc<ConstructorDeclaration>
, NodeWithModifiers<ConstructorDeclaration>
, NodeWithParameters<ConstructorDeclaration>
, NodeWithRange<ConstructorDeclaration>
, NodeWithSimpleName<ConstructorDeclaration>
, NodeWithThrownExceptions<ConstructorDeclaration>
, NodeWithTokenRange<ConstructorDeclaration>
, NodeWithTypeParameters<ConstructorDeclaration>
, Observable
, Visitable
, HasParentNode<ConstructorDeclaration>
, Cloneable
public final class ConstructorDeclaration extends CallableDeclaration<ConstructorDeclaration> implements NodeWithBlockStmt<ConstructorDeclaration>, NodeWithAccessModifiers<ConstructorDeclaration>, NodeWithJavadoc<ConstructorDeclaration>, NodeWithDeclaration, NodeWithSimpleName<ConstructorDeclaration>, NodeWithParameters<ConstructorDeclaration>, NodeWithThrownExceptions<ConstructorDeclaration>, NodeWithTypeParameters<ConstructorDeclaration>
class X { X() { } }
where X(){} is the constructor declaration.CallableDeclaration.Signature
Node.ObserverRegistrationMode, Node.Parsedness
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
Constructor | Description |
---|---|
ConstructorDeclaration() |
|
ConstructorDeclaration(TokenRange tokenRange,
EnumSet<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
NodeList<TypeParameter> typeParameters,
SimpleName name,
NodeList<Parameter> parameters,
NodeList<ReferenceType> thrownExceptions,
BlockStmt body) |
This constructor is used by the parser and is considered private.
|
ConstructorDeclaration(EnumSet<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
NodeList<TypeParameter> typeParameters,
SimpleName name,
NodeList<Parameter> parameters,
NodeList<ReferenceType> thrownExceptions,
BlockStmt body) |
|
ConstructorDeclaration(EnumSet<Modifier> modifiers,
String name) |
Modifier and Type | Method | Description |
---|---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg) |
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg) |
Accept method for visitor support.
|
ConstructorDeclaration |
clone() |
|
BlockStmt |
getBody() |
|
String |
getDeclarationAsString(boolean includingModifiers,
boolean includingThrows,
boolean includingParameterName) |
The declaration returned has this schema:
|
ConstructorDeclarationMetaModel |
getMetaModel() |
|
List<NodeList<?>> |
getNodeLists() |
The list of NodeLists owned by this node.
|
boolean |
remove(Node node) |
|
boolean |
replace(Node node,
Node replacementNode) |
|
ConstructorDeclaration |
setBody(BlockStmt body) |
Sets the body
|
ConstructorDeclaration |
setModifiers(EnumSet<Modifier> modifiers) |
|
ConstructorDeclaration |
setName(SimpleName name) |
|
ConstructorDeclaration |
setParameters(NodeList<Parameter> parameters) |
|
ConstructorDeclaration |
setThrownExceptions(NodeList<ReferenceType> thrownExceptions) |
|
ConstructorDeclaration |
setTypeParameters(NodeList<TypeParameter> typeParameters) |
getAnnotations, setAnnotations
appendThrowsIfRequested, getDeclarationAsString, getDeclarationAsString, getModifiers, getName, getParameters, getSignature, getThrownExceptions, getTypeParameters
getAncestorOfType
addOrphanComment, customInitialization, equals, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
isAbstract, setAbstract
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
createBody
getDeclarationAsString, getDeclarationAsString
isFinal, setFinal
getComment, getJavadoc, getJavadocComment, hasJavaDocComment, removeJavaDocComment, setComment, setJavadocComment, setJavadocComment, setJavadocComment
addModifier, getModifiers, removeModifier, setModifier
addAndGetParameter, addAndGetParameter, addAndGetParameter, addAndGetParameter, addParameter, addParameter, addParameter, addParameter, getParameter, getParameterByName, getParameterByType, getParameterByType, getParameters, hasParametersOfType, hasParametersOfType, setParameter, tryAddImportToParentCompilationUnit
isPrivate, setPrivate
isProtected, setProtected
isPublic, setPublic
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
getName, getNameAsString, setName
isStatic, setStatic
isStrictfp, setStrictfp
addThrownException, addThrownException, getThrownException, getThrownExceptions, isThrown, isThrown, tryAddImportToParentCompilationUnit
addTypeParameter, getTypeParameter, getTypeParameters, isGeneric, setTypeParameter
public ConstructorDeclaration()
public ConstructorDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions, BlockStmt body)
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") public ConstructorDeclaration(TokenRange tokenRange, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions, BlockStmt body)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitable
accept
in interface Visitable
R
- 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)
Visitable
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public BlockStmt getBody()
getBody
in interface NodeWithBlockStmt<ConstructorDeclaration>
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public ConstructorDeclaration setBody(BlockStmt body)
setBody
in interface NodeWithBlockStmt<ConstructorDeclaration>
body
- the body, can not be nullpublic ConstructorDeclaration setModifiers(EnumSet<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 NodeWithDeclaration
getDeclarationAsString
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 produced@Generated("com.github.javaparser.generator.core.node.GetNodeListsGenerator") public List<NodeList<?>> getNodeLists()
Node
getNodeLists
in class CallableDeclaration<ConstructorDeclaration>
@Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
remove
in class CallableDeclaration<ConstructorDeclaration>
@Generated("com.github.javaparser.generator.core.node.CloneGenerator") public ConstructorDeclaration clone()
clone
in class CallableDeclaration<ConstructorDeclaration>
@Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") public ConstructorDeclarationMetaModel getMetaModel()
getMetaModel
in class CallableDeclaration<ConstructorDeclaration>
@Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
replace
in class CallableDeclaration<ConstructorDeclaration>
Copyright © 2007–2019. All rights reserved.