Package de.fraunhofer.aisec.cpg.graph
Class FunctionDeclaration
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.graph.Node
-
- de.fraunhofer.aisec.cpg.graph.Declaration
-
- de.fraunhofer.aisec.cpg.graph.ValueDeclaration
-
- de.fraunhofer.aisec.cpg.graph.FunctionDeclaration
-
- All Implemented Interfaces:
HasType
- Direct Known Subclasses:
MethodDeclaration
public class FunctionDeclaration extends ValueDeclaration
Represents the declaration or definition of a function.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.fraunhofer.aisec.cpg.graph.HasType
HasType.TypeListener
-
-
Field Summary
Fields Modifier and Type Field Description protected StatementbodyThe function body.protected java.util.List<ParamVariableDeclaration>parametersThe list of function parameters.protected java.util.List<Type>throwsTypes-
Fields inherited from class de.fraunhofer.aisec.cpg.graph.ValueDeclaration
possibleSubTypes, type
-
-
Constructor Summary
Constructors Constructor Description FunctionDeclaration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)StatementgetBody()<T> @Nullable TgetBodyStatementAs(int i, java.lang.Class<T> clazz)java.util.List<FunctionDeclaration>getOverriddenBy()java.util.List<FunctionDeclaration>getOverrides()java.util.List<ParamVariableDeclaration>getParameters()java.lang.StringgetSignature()java.util.List<Type>getThrowsTypes()java.util.Optional<VariableDeclaration>getVariableDeclarationByName(java.lang.String name)Looks for a variable declaration by the given name.booleanhasBody()inthashCode()booleanhasSignature(java.util.List<Type> targetSignature)booleanisOverrideCandidate(FunctionDeclaration other)voidsetBody(Statement body)voidsetParameters(java.util.List<ParamVariableDeclaration> parameters)voidsetThrowsTypes(java.util.List<Type> throwsTypes)java.lang.StringtoString()-
Methods inherited from class de.fraunhofer.aisec.cpg.graph.ValueDeclaration
getPossibleSubTypes, getType, getTypeListeners, refreshType, registerTypeListener, resetTypes, setPossibleSubTypes, setType, unregisterTypeListener
-
Methods inherited from class de.fraunhofer.aisec.cpg.graph.Node
addNextDFG, addPrevDFG, disconnectFromGraph, getArgumentIndex, getCode, getFile, getId, getLocation, getName, getNextCFG, getNextDFG, getNextEOG, getPrevDFG, getPrevEOG, isDummy, isImplicit, removeNextDFG, removePrevDFG, setArgumentIndex, setCode, setComment, setDummy, setFile, setImplicit, setLocation, setName, setNextDFG, setNextEOG, setPrevDFG, setPrevEOG
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.fraunhofer.aisec.cpg.graph.HasType
setPossibleSubTypes, setType
-
-
-
-
Field Detail
-
body
protected Statement body
The function body. Usually aCompoundStatement.
-
parameters
protected java.util.List<ParamVariableDeclaration> parameters
The list of function parameters.
-
throwsTypes
protected java.util.List<Type> throwsTypes
-
-
Method Detail
-
hasBody
public boolean hasBody()
-
getSignature
public java.lang.String getSignature()
-
hasSignature
public boolean hasSignature(java.util.List<Type> targetSignature)
-
isOverrideCandidate
public boolean isOverrideCandidate(FunctionDeclaration other)
-
getOverriddenBy
public java.util.List<FunctionDeclaration> getOverriddenBy()
-
getOverrides
public java.util.List<FunctionDeclaration> getOverrides()
-
getThrowsTypes
public java.util.List<Type> getThrowsTypes()
-
setThrowsTypes
public void setThrowsTypes(java.util.List<Type> throwsTypes)
-
getBody
public Statement getBody()
-
getBodyStatementAs
public <T> @Nullable T getBodyStatementAs(int i, java.lang.Class<T> clazz)
-
setBody
public void setBody(Statement body)
-
getParameters
public java.util.List<ParamVariableDeclaration> getParameters()
-
setParameters
public void setParameters(java.util.List<ParamVariableDeclaration> parameters)
-
getVariableDeclarationByName
public java.util.Optional<VariableDeclaration> getVariableDeclarationByName(java.lang.String name)
Looks for a variable declaration by the given name.- Parameters:
name- the name of the variable- Returns:
- an optional value containing the variable declaration if found
-
toString
public java.lang.String toString()
- Overrides:
toStringin classValueDeclaration
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classValueDeclaration
-
hashCode
public int hashCode()
- Overrides:
hashCodein classValueDeclaration
-
-