public class CompactConstructorDeclaration extends BodyDeclaration<CompactConstructorDeclaration> implements NodeWithBlockStmt<CompactConstructorDeclaration>, NodeWithAccessModifiers<CompactConstructorDeclaration>, NodeWithJavadoc<CompactConstructorDeclaration>, NodeWithSimpleName<CompactConstructorDeclaration>, NodeWithThrownExceptions<CompactConstructorDeclaration>, NodeWithTypeParameters<CompactConstructorDeclaration>, Resolvable<ResolvedConstructorDeclaration>
A record "compact" constructor declaration: class X(int a, int b) { public X{ } }
where public X{}
is the compact record constructor declaration.
Note that the record constructor is distinct from a "standard" constructor as it does not permit arguments/parameters.
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.
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, LINE_SEPARATOR_KEY, NODE_BY_BEGIN_POSITION, PHANTOM_KEY, prettyPrinterNoCommentsConfiguration, PRINTER_KEY, SYMBOL_RESOLVER_KEY
Constructor and Description |
---|
CompactConstructorDeclaration() |
CompactConstructorDeclaration(NodeList<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
NodeList<TypeParameter> typeParameters,
SimpleName name,
NodeList<ReferenceType> thrownExceptions,
BlockStmt body) |
CompactConstructorDeclaration(NodeList<Modifier> modifiers,
String name) |
CompactConstructorDeclaration(String name) |
CompactConstructorDeclaration(TokenRange tokenRange,
NodeList<AnnotationExpr> annotations,
BlockStmt body)
This constructor is used by the parser and is considered private.
|
CompactConstructorDeclaration(TokenRange tokenRange,
NodeList<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
NodeList<TypeParameter> typeParameters,
SimpleName name,
NodeList<ReferenceType> thrownExceptions,
BlockStmt body)
This constructor is used by the parser and is considered private.
|
asAnnotationDeclaration, asAnnotationMemberDeclaration, asCallableDeclaration, asClassOrInterfaceDeclaration, asConstructorDeclaration, asEnumConstantDeclaration, asEnumDeclaration, asFieldDeclaration, asInitializerDeclaration, asMethodDeclaration, asRecordDeclaration, asTypeDeclaration, getAnnotations, ifAnnotationDeclaration, ifAnnotationMemberDeclaration, ifCallableDeclaration, ifClassOrInterfaceDeclaration, ifConstructorDeclaration, ifEnumConstantDeclaration, ifEnumDeclaration, ifFieldDeclaration, ifInitializerDeclaration, ifMethodDeclaration, ifRecordDeclaration, ifTypeDeclaration, isAnnotationDeclaration, isAnnotationMemberDeclaration, isCallableDeclaration, isClassOrInterfaceDeclaration, isConstructorDeclaration, isEnumConstantDeclaration, isEnumDeclaration, isFieldDeclaration, isInitializerDeclaration, isMethodDeclaration, isRecordDeclaration, isTypeDeclaration, setAnnotations, toAnnotationDeclaration, toAnnotationMemberDeclaration, toCallableDeclaration, toClassOrInterfaceDeclaration, toConstructorDeclaration, toEnumConstantDeclaration, toEnumDeclaration, toFieldDeclaration, toInitializerDeclaration, toMethodDeclaration, toRecordDeclaration, toTypeDeclaration
addOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findByRange, findCompilationUnit, findData, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getDataKeys, getDefaultPrinterConfiguration, getLineEndingStyle, getLineEndingStyleOrDefault, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getPrinter, getPrinter, getRange, getSymbolResolver, getTokenRange, hashCode, hasScope, isAncestorOf, isPhantom, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walk
finalize, getClass, notify, notifyAll, wait, wait, wait
createBody
isPublic, setPublic
isPrivate, setPrivate
isProtected, setProtected
addModifier, getAccessSpecifier, hasModifier, removeModifier, setModifier, setModifiers
getComment, getJavadoc, getJavadocComment, hasJavaDocComment, removeJavaDocComment, setComment, setJavadocComment, setJavadocComment, setJavadocComment, setJavadocComment
getNameAsExpression, getNameAsString, setName
addThrownException, addThrownException, getThrownException, isThrown, isThrown, tryAddImportToParentCompilationUnit
addTypeParameter, addTypeParameter, getTypeParameter, isGeneric, setTypeParameter
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
findAncestor, findAncestor, findAncestor, hasParentNode, isDescendantOf
containsWithin, containsWithinRange, getBegin, getEnd, hasRange
public CompactConstructorDeclaration()
public CompactConstructorDeclaration(String name)
public CompactConstructorDeclaration(NodeList<Modifier> modifiers, String name)
public CompactConstructorDeclaration(NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<ReferenceType> thrownExceptions, BlockStmt body)
public CompactConstructorDeclaration(TokenRange tokenRange, NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<ReferenceType> thrownExceptions, BlockStmt body)
public CompactConstructorDeclaration(TokenRange tokenRange, NodeList<AnnotationExpr> annotations, 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
public BlockStmt getBody()
getBody
in interface NodeWithBlockStmt<CompactConstructorDeclaration>
public CompactConstructorDeclaration setBody(BlockStmt body)
setBody
in interface NodeWithBlockStmt<CompactConstructorDeclaration>
body
- the body, can not be nullpublic NodeList<Modifier> getModifiers()
NodeWithModifiers
getModifiers
in interface NodeWithModifiers<CompactConstructorDeclaration>
Modifier
public CompactConstructorDeclaration setModifiers(NodeList<Modifier> modifiers)
setModifiers
in interface NodeWithModifiers<CompactConstructorDeclaration>
public SimpleName getName()
getName
in interface NodeWithSimpleName<CompactConstructorDeclaration>
public CompactConstructorDeclaration setName(SimpleName name)
setName
in interface NodeWithSimpleName<CompactConstructorDeclaration>
public NodeList<ReferenceType> getThrownExceptions()
getThrownExceptions
in interface NodeWithThrownExceptions<CompactConstructorDeclaration>
public CompactConstructorDeclaration setThrownExceptions(NodeList<ReferenceType> thrownExceptions)
setThrownExceptions
in interface NodeWithThrownExceptions<CompactConstructorDeclaration>
public NodeList<TypeParameter> getTypeParameters()
getTypeParameters
in interface NodeWithTypeParameters<CompactConstructorDeclaration>
public CompactConstructorDeclaration setTypeParameters(NodeList<TypeParameter> typeParameters)
setTypeParameters
in interface NodeWithTypeParameters<CompactConstructorDeclaration>
public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName)
[accessSpecifier] className [throws exceptionsList]
protected String appendThrowsIfRequested(boolean includingThrows)
public boolean remove(Node node)
remove
in class BodyDeclaration<CompactConstructorDeclaration>
public CompactConstructorDeclaration clone()
clone
in class BodyDeclaration<CompactConstructorDeclaration>
public CompactConstructorDeclarationMetaModel getMetaModel()
getMetaModel
in class BodyDeclaration<CompactConstructorDeclaration>
public boolean replace(Node node, Node replacementNode)
replace
in class BodyDeclaration<CompactConstructorDeclaration>
public boolean isCompactConstructorDeclaration()
isCompactConstructorDeclaration
in class BodyDeclaration<CompactConstructorDeclaration>
public CompactConstructorDeclaration asCompactConstructorDeclaration()
asCompactConstructorDeclaration
in class BodyDeclaration<CompactConstructorDeclaration>
public void ifCompactConstructorDeclaration(Consumer<CompactConstructorDeclaration> action)
ifCompactConstructorDeclaration
in class BodyDeclaration<CompactConstructorDeclaration>
public ResolvedConstructorDeclaration resolve()
resolve
in interface Resolvable<ResolvedConstructorDeclaration>
public Optional<CompactConstructorDeclaration> toCompactConstructorDeclaration()
toCompactConstructorDeclaration
in class BodyDeclaration<CompactConstructorDeclaration>
Copyright © 2007–2024. All rights reserved.