Package com.github.javaparser.ast.body
Class CallableDeclaration<T extends CallableDeclaration<?>>
- java.lang.Object
-
- com.github.javaparser.ast.Node
-
- com.github.javaparser.ast.body.BodyDeclaration<T>
-
- com.github.javaparser.ast.body.CallableDeclaration<T>
-
- All Implemented Interfaces:
NodeWithAbstractModifier<T>
,NodeWithAccessModifiers<T>
,NodeWithFinalModifier<T>
,NodeWithPrivateModifier<T>
,NodeWithProtectedModifier<T>
,NodeWithPublicModifier<T>
,NodeWithStaticModifier<T>
,NodeWithStrictfpModifier<T>
,NodeWithAnnotations<T>
,NodeWithDeclaration
,NodeWithJavadoc<T>
,NodeWithModifiers<T>
,NodeWithParameters<T>
,NodeWithRange<Node>
,NodeWithSimpleName<T>
,NodeWithThrownExceptions<T>
,NodeWithTokenRange<Node>
,NodeWithTypeParameters<T>
,Observable
,Visitable
,HasParentNode<Node>
,Cloneable
- Direct Known Subclasses:
ConstructorDeclaration
,MethodDeclaration
public abstract class CallableDeclaration<T extends CallableDeclaration<?>> extends BodyDeclaration<T> implements NodeWithAccessModifiers<T>, NodeWithDeclaration, NodeWithSimpleName<T>, NodeWithParameters<T>, NodeWithThrownExceptions<T>, NodeWithTypeParameters<T>, NodeWithJavadoc<T>, NodeWithAbstractModifier<T>, NodeWithStaticModifier<T>, NodeWithFinalModifier<T>, NodeWithStrictfpModifier<T>
Represents a declaration which is callable eg. a method or a constructor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CallableDeclaration.Signature
A method or constructor signature.-
Nested classes/interfaces inherited from class com.github.javaparser.ast.Node
Node.ObserverRegistrationMode, Node.Parsedness
-
-
Field Summary
-
Fields inherited from class com.github.javaparser.ast.Node
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
-
-
Constructor Summary
Constructors Constructor Description CallableDeclaration(TokenRange tokenRange, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions)
This constructor is used by the parser and is considered private.CallableDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions)
-
Method Summary
-
Methods inherited from class com.github.javaparser.ast.body.BodyDeclaration
getAnnotations, setAnnotations
-
Methods inherited from class com.github.javaparser.ast.Node
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
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.javaparser.HasParentNode
getAncestorOfType
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithAbstractModifier
isAbstract, setAbstract
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithAnnotations
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithFinalModifier
isFinal, setFinal
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithJavadoc
getComment, getJavadoc, getJavadocComment, hasJavaDocComment, removeJavaDocComment, setComment, setJavadocComment, setJavadocComment, setJavadocComment
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithModifiers
addModifier, removeModifier, setModifier
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithParameters
addAndGetParameter, addAndGetParameter, addAndGetParameter, addAndGetParameter, addParameter, addParameter, addParameter, addParameter, getParameter, getParameterByName, getParameterByType, getParameterByType, hasParametersOfType, hasParametersOfType, setParameter, tryAddImportToParentCompilationUnit
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithPrivateModifier
isPrivate, setPrivate
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithProtectedModifier
isProtected, setProtected
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithPublicModifier
isPublic, setPublic
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithRange
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithSimpleName
getNameAsString, setName
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithStaticModifier
isStatic, setStatic
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.modifiers.NodeWithStrictfpModifier
isStrictfp, setStrictfp
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithThrownExceptions
addThrownException, addThrownException, getThrownException, isThrown, isThrown, tryAddImportToParentCompilationUnit
-
Methods inherited from interface com.github.javaparser.ast.nodeTypes.NodeWithTypeParameters
addTypeParameter, getTypeParameter, isGeneric, setTypeParameter
-
-
-
-
Constructor Detail
-
CallableDeclaration
public CallableDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions)
-
CallableDeclaration
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") public CallableDeclaration(TokenRange tokenRange, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<TypeParameter> typeParameters, SimpleName name, NodeList<Parameter> parameters, NodeList<ReferenceType> thrownExceptions)
This constructor is used by the parser and is considered private.
-
-
Method Detail
-
getModifiers
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public EnumSet<Modifier> getModifiers()
Return the modifiers of this member declaration.- Specified by:
getModifiers
in interfaceNodeWithModifiers<T extends CallableDeclaration<?>>
- Returns:
- modifiers
- See Also:
Modifier
-
setModifiers
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public T setModifiers(EnumSet<Modifier> modifiers)
- Specified by:
setModifiers
in interfaceNodeWithModifiers<T extends CallableDeclaration<?>>
-
getName
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public SimpleName getName()
- Specified by:
getName
in interfaceNodeWithSimpleName<T extends CallableDeclaration<?>>
-
setName
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public T setName(SimpleName name)
- Specified by:
setName
in interfaceNodeWithSimpleName<T extends CallableDeclaration<?>>
-
getParameters
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<Parameter> getParameters()
- Specified by:
getParameters
in interfaceNodeWithParameters<T extends CallableDeclaration<?>>
-
setParameters
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public T setParameters(NodeList<Parameter> parameters)
- Specified by:
setParameters
in interfaceNodeWithParameters<T extends CallableDeclaration<?>>
-
getThrownExceptions
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<ReferenceType> getThrownExceptions()
- Specified by:
getThrownExceptions
in interfaceNodeWithThrownExceptions<T extends CallableDeclaration<?>>
-
setThrownExceptions
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public T setThrownExceptions(NodeList<ReferenceType> thrownExceptions)
- Specified by:
setThrownExceptions
in interfaceNodeWithThrownExceptions<T extends CallableDeclaration<?>>
-
getTypeParameters
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<TypeParameter> getTypeParameters()
- Specified by:
getTypeParameters
in interfaceNodeWithTypeParameters<T extends CallableDeclaration<?>>
-
setTypeParameters
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") public T setTypeParameters(NodeList<TypeParameter> typeParameters)
- Specified by:
setTypeParameters
in interfaceNodeWithTypeParameters<T extends CallableDeclaration<?>>
-
getDeclarationAsString
public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows)
Description copied from interface:NodeWithDeclaration
AsNodeWithDeclaration.getDeclarationAsString(boolean, boolean, boolean)
including the parameters with both type and name.- Specified by:
getDeclarationAsString
in interfaceNodeWithDeclaration
- Parameters:
includingModifiers
- flag to include the modifiers (if present) in the string producedincludingThrows
- flag to include the throws clause (if present) in the string produced- Returns:
- String representation of declaration based on parameter flags
-
getDeclarationAsString
public String getDeclarationAsString()
Description copied from interface:NodeWithDeclaration
AsNodeWithDeclaration.getDeclarationAsString(boolean, boolean, boolean)
including the modifiers, the throws clause and the parameters with both type and name.- Specified by:
getDeclarationAsString
in interfaceNodeWithDeclaration
- Returns:
- String representation of declaration
-
getDeclarationAsString
public abstract String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName)
Description copied from interface:NodeWithDeclaration
A simple representation of the element declaration. It should fit one string.- Specified by:
getDeclarationAsString
in interfaceNodeWithDeclaration
- Parameters:
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- Returns:
- String representation of declaration based on parameter flags
-
appendThrowsIfRequested
protected String appendThrowsIfRequested(boolean includingThrows)
-
getNodeLists
public List<NodeList<?>> getNodeLists()
Description copied from class:Node
The list of NodeLists owned by this node.- Overrides:
getNodeLists
in classBodyDeclaration<T extends CallableDeclaration<?>>
-
remove
@Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
- Overrides:
remove
in classBodyDeclaration<T extends CallableDeclaration<?>>
-
getSignature
public CallableDeclaration.Signature getSignature()
-
clone
@Generated("com.github.javaparser.generator.core.node.CloneGenerator") public CallableDeclaration<?> clone()
- Overrides:
clone
in classBodyDeclaration<T extends CallableDeclaration<?>>
-
getMetaModel
@Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") public CallableDeclarationMetaModel getMetaModel()
- Overrides:
getMetaModel
in classBodyDeclaration<T extends CallableDeclaration<?>>
- Returns:
- get JavaParser specific node introspection information.
-
replace
@Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
- Overrides:
replace
in classBodyDeclaration<T extends CallableDeclaration<?>>
-
-