Class RecordDeclaration
java.lang.Object
de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.declarations.Declaration
de.fraunhofer.aisec.cpg.graph.declarations.RecordDeclaration
- All Implemented Interfaces:
DeclarationHolder,Persistable,StatementHolder,IVisitable<de.fraunhofer.aisec.cpg.graph.Node>
public class RecordDeclaration extends Declaration implements DeclarationHolder, StatementHolder
Represents a C++ union/struct/class or Java class
-
Nested Class Summary
Nested classes/interfaces inherited from class de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.graph.Node.Companion -
Field Summary
Fields inherited from class de.fraunhofer.aisec.cpg.graph.Node
Companion, EMPTY_NAME, TO_STRING_STYLE -
Constructor Summary
Constructors Constructor Description RecordDeclaration() -
Method Summary
Modifier and Type Method Description voidaddConstructor(ConstructorDeclaration constructorDeclaration)voidaddDeclaration(@NonNull Declaration declaration)Adds the specified declaration to this declaration holder.voidaddField(FieldDeclaration fieldDeclaration)voidaddMethod(MethodDeclaration methodDeclaration)booleanequals(java.lang.Object o)java.util.List<ConstructorDeclaration>getConstructors()java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<ConstructorDeclaration>>getConstructorsPropertyEdge()java.util.List<Declaration>getDeclarations()@Nullable FieldDeclarationgetField(java.lang.String name)java.util.List<FieldDeclaration>getFields()java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<FieldDeclaration>>getFieldsPropertyEdge()java.util.List<Type>getImplementedInterfaces()Interfaces implemented by this class.java.util.Set<Declaration>getImports()java.util.List<java.lang.String>getImportStatements()java.lang.StringgetKind()java.util.List<MethodDeclaration>getMethods()java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<MethodDeclaration>>getMethodsPropertyEdge()java.util.List<RecordDeclaration>getRecords()java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<RecordDeclaration>>getRecordsPropertyEdge()@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>>getStatementEdges()Getter to be implemented by implementing classes to gain read access to the classes member.java.util.Set<ValueDeclaration>getStaticImports()java.util.List<java.lang.String>getStaticImportStatements()java.util.List<Type>getSuperClasses()The classes that are extended by this one.java.util.Set<RecordDeclaration>getSuperTypeDeclarations()java.util.List<Type>getSuperTypes()Combines both implemented interfaces and extended classes.java.util.List<TemplateDeclaration>getTemplates()java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<TemplateDeclaration>>getTemplatesPropertyEdge()FieldDeclarationgetThis()inthashCode()voidremoveConstructor(ConstructorDeclaration constructorDeclaration)voidremoveField(FieldDeclaration fieldDeclaration)voidremoveMethod(MethodDeclaration methodDeclaration)voidremoveRecord(RecordDeclaration recordDeclaration)voidremoveTemplate(TemplateDeclaration templateDeclaration)voidsetConstructors(java.util.List<ConstructorDeclaration> constructors)voidsetFields(java.util.List<FieldDeclaration> fields)voidsetImplementedInterfaces(java.util.List<Type> implementedInterfaces)voidsetImports(java.util.Set<Declaration> imports)voidsetImportStatements(java.util.List<java.lang.String> importStatements)voidsetKind(java.lang.String kind)voidsetMethods(java.util.List<MethodDeclaration> methods)voidsetName(@NonNull java.lang.String name)It is important to set this name to a full qualified name (FQN).voidsetRecords(java.util.List<RecordDeclaration> records)voidsetStatementEdges(@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> statements)voidsetStaticImports(java.util.Set<ValueDeclaration> staticImports)voidsetStaticImportStatements(java.util.List<java.lang.String> staticImportStatements)voidsetSuperClasses(java.util.List<Type> superClasses)voidsetSuperTypeDeclarations(java.util.Set<RecordDeclaration> superTypeDeclarations)voidsetTemplates(java.util.List<TemplateDeclaration> templates)java.lang.StringtoString()TypetoType()Returns a type represented by this record.Methods inherited from class de.fraunhofer.aisec.cpg.graph.Node
addAnnotations, addNextDFG, addNextEOG, addPrevDFG, addPrevEOG, addTypedef, clearNextEOG, disconnectFromGraph, getAnnotations, getArgumentIndex, getCode, getComment, getFile, getId, getLocation, getName, getNextDFG, getNextEOG, getNextEOGEdges, getPrevDFG, getPrevEOG, getPrevEOGEdges, getTypedefs, isImplicit, isInferred, removeNextDFG, removePrevDFG, removePrevEOGEntry, setAnnotations, setArgumentIndex, setCode, setComment, setFile, setId, setImplicit, setInferred, setLocation, setNextDFG, setNextEOG, setNextEOGEdges, setPrevDFG, setPrevEOG, setPrevEOGEdges, setTypedefsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.fraunhofer.aisec.cpg.graph.DeclarationHolder
addIfNotContains, addIfNotContains, addIfNotContainsMethods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable
acceptMethods inherited from interface de.fraunhofer.aisec.cpg.graph.StatementHolder
addStatement, getStatements, getStatementsPropertyEdge, setStatements
-
Constructor Details
-
RecordDeclaration
public RecordDeclaration()
-
-
Method Details
-
setName
public void setName(@NonNull java.lang.String name)It is important to set this name to a full qualified name (FQN).- Overrides:
setNamein classde.fraunhofer.aisec.cpg.graph.Node- Parameters:
name- the FQN
-
getKind
public java.lang.String getKind() -
setKind
public void setKind(java.lang.String kind) -
getFields
-
getFieldsPropertyEdge
public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<FieldDeclaration>> getFieldsPropertyEdge() -
addField
-
removeField
-
getField
-
setFields
-
getThis
-
getMethods
-
getMethodsPropertyEdge
public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<MethodDeclaration>> getMethodsPropertyEdge() -
addMethod
-
removeMethod
-
setMethods
-
getConstructors
-
getConstructorsPropertyEdge
public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<ConstructorDeclaration>> getConstructorsPropertyEdge() -
setConstructors
-
addConstructor
-
removeConstructor
-
getRecords
-
getRecordsPropertyEdge
public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<RecordDeclaration>> getRecordsPropertyEdge() -
setRecords
-
removeRecord
-
getTemplates
-
getTemplatesPropertyEdge
public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<TemplateDeclaration>> getTemplatesPropertyEdge() -
setTemplates
-
removeTemplate
-
getDeclarations
- Specified by:
getDeclarationsin interfaceDeclarationHolder
-
getSuperTypes
Combines both implemented interfaces and extended classes. This is most commonly what you are looking for when looking for method call targets etc.- Returns:
- concatenation of
getSuperClasses()andgetImplementedInterfaces()
-
getSuperClasses
The classes that are extended by this one. Usually zero or one, but in C++ this can contain multiple classes- Returns:
- extended classes
-
setSuperClasses
-
getImplementedInterfaces
Interfaces implemented by this class. This concept is not present in C++- Returns:
- the list of implemented interfaces
-
setImplementedInterfaces
-
getSuperTypeDeclarations
-
setSuperTypeDeclarations
-
getImports
-
setImports
-
getStaticImports
-
setStaticImports
-
getImportStatements
public java.util.List<java.lang.String> getImportStatements() -
setImportStatements
public void setImportStatements(java.util.List<java.lang.String> importStatements) -
getStaticImportStatements
public java.util.List<java.lang.String> getStaticImportStatements() -
setStaticImportStatements
public void setStaticImportStatements(java.util.List<java.lang.String> staticImportStatements) -
getStatementEdges
public @NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> getStatementEdges()Description copied from interface:StatementHolderGetter to be implemented by implementing classes to gain read access to the classes member.- Specified by:
getStatementEdgesin interfaceStatementHolder- Returns:
- List of property Edge statements
-
setStatementEdges
public void setStatementEdges(@NonNull java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<Statement>> statements)- Specified by:
setStatementEdgesin interfaceStatementHolder
-
toString
public java.lang.String toString()- Overrides:
toStringin classde.fraunhofer.aisec.cpg.graph.Node
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classde.fraunhofer.aisec.cpg.graph.Node
-
hashCode
public int hashCode()- Overrides:
hashCodein classde.fraunhofer.aisec.cpg.graph.Node
-
addDeclaration
Description copied from interface:DeclarationHolderAdds the specified declaration to this declaration holder. Ideally, the declaration holder should use theDeclarationHolder.addIfNotContains(Collection, Declaration)method to consistently add declarations.- Specified by:
addDeclarationin interfaceDeclarationHolder- Parameters:
declaration- the declaration
-
toType
Returns a type represented by this record.- Returns:
- the type
-