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
  • 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:
      setName in class de.fraunhofer.aisec.cpg.graph.Node
      Parameters:
      name - the FQN
    • getKind

      public java.lang.String getKind()
    • setKind

      public void setKind​(java.lang.String kind)
    • getFields

      public java.util.List<FieldDeclaration> getFields()
    • getFieldsPropertyEdge

      public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<FieldDeclaration>> getFieldsPropertyEdge()
    • addField

      public void addField​(FieldDeclaration fieldDeclaration)
    • removeField

      public void removeField​(FieldDeclaration fieldDeclaration)
    • getField

      public @Nullable FieldDeclaration getField​(java.lang.String name)
    • setFields

      public void setFields​(java.util.List<FieldDeclaration> fields)
    • getThis

      public FieldDeclaration getThis()
    • getMethods

      public java.util.List<MethodDeclaration> getMethods()
    • getMethodsPropertyEdge

      public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<MethodDeclaration>> getMethodsPropertyEdge()
    • addMethod

      public void addMethod​(MethodDeclaration methodDeclaration)
    • removeMethod

      public void removeMethod​(MethodDeclaration methodDeclaration)
    • setMethods

      public void setMethods​(java.util.List<MethodDeclaration> methods)
    • getConstructors

      public java.util.List<ConstructorDeclaration> getConstructors()
    • getConstructorsPropertyEdge

      public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<ConstructorDeclaration>> getConstructorsPropertyEdge()
    • setConstructors

      public void setConstructors​(java.util.List<ConstructorDeclaration> constructors)
    • addConstructor

      public void addConstructor​(ConstructorDeclaration constructorDeclaration)
    • removeConstructor

      public void removeConstructor​(ConstructorDeclaration constructorDeclaration)
    • getRecords

      public java.util.List<RecordDeclaration> getRecords()
    • getRecordsPropertyEdge

      public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<RecordDeclaration>> getRecordsPropertyEdge()
    • setRecords

      public void setRecords​(java.util.List<RecordDeclaration> records)
    • removeRecord

      public void removeRecord​(RecordDeclaration recordDeclaration)
    • getTemplates

      public java.util.List<TemplateDeclaration> getTemplates()
    • getTemplatesPropertyEdge

      public java.util.List<de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge<TemplateDeclaration>> getTemplatesPropertyEdge()
    • setTemplates

      public void setTemplates​(java.util.List<TemplateDeclaration> templates)
    • removeTemplate

      public void removeTemplate​(TemplateDeclaration templateDeclaration)
    • getDeclarations

      @NotNull public java.util.List<Declaration> getDeclarations()
      Specified by:
      getDeclarations in interface DeclarationHolder
    • getSuperTypes

      public java.util.List<Type> 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() and getImplementedInterfaces()
    • getSuperClasses

      public java.util.List<Type> 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

      public void setSuperClasses​(java.util.List<Type> superClasses)
    • getImplementedInterfaces

      public java.util.List<Type> getImplementedInterfaces()
      Interfaces implemented by this class. This concept is not present in C++
      Returns:
      the list of implemented interfaces
    • setImplementedInterfaces

      public void setImplementedInterfaces​(java.util.List<Type> implementedInterfaces)
    • getSuperTypeDeclarations

      public java.util.Set<RecordDeclaration> getSuperTypeDeclarations()
    • setSuperTypeDeclarations

      public void setSuperTypeDeclarations​(java.util.Set<RecordDeclaration> superTypeDeclarations)
    • getImports

      public java.util.Set<Declaration> getImports()
    • setImports

      public void setImports​(java.util.Set<Declaration> imports)
    • getStaticImports

      public java.util.Set<ValueDeclaration> getStaticImports()
    • setStaticImports

      public void setStaticImports​(java.util.Set<ValueDeclaration> staticImports)
    • 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: StatementHolder
      Getter to be implemented by implementing classes to gain read access to the classes member.
      Specified by:
      getStatementEdges in interface StatementHolder
      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:
      setStatementEdges in interface StatementHolder
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class de.fraunhofer.aisec.cpg.graph.Node
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class de.fraunhofer.aisec.cpg.graph.Node
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class de.fraunhofer.aisec.cpg.graph.Node
    • addDeclaration

      public void addDeclaration​(@NonNull Declaration declaration)
      Description copied from interface: DeclarationHolder
      Adds the specified declaration to this declaration holder. Ideally, the declaration holder should use the DeclarationHolder.addIfNotContains(Collection, Declaration) method to consistently add declarations.
      Specified by:
      addDeclaration in interface DeclarationHolder
      Parameters:
      declaration - the declaration
    • toType

      public Type toType()
      Returns a type represented by this record.
      Returns:
      the type