Class NamespaceDeclaration

  • All Implemented Interfaces:
    DeclarationHolder, Persistable, IVisitable<Node>

    public class NamespaceDeclaration
    extends Declaration
    implements DeclarationHolder
    Declares the scope of a namespace and appends its own name to the current namespace-prefix to form a new namespace prefix. While RecordDeclarations in C++ and Java have their own namespace, namespace declarations can be declared multiple times. At the beginning of a Java-file, a namespace declaration is used to represent the package name as namespace. In its explicit appearance a namespace declaration can contain FunctionDeclaration, FieldDeclaration and RecordDeclaration similar to a RecordDeclaration and the semantical difference between NamespaceDeclaration and RecordDeclaration lies in the non-instantiabillity of a namespace.
    • Constructor Detail

      • NamespaceDeclaration

        public NamespaceDeclaration()
    • Method Detail

      • getDeclarations

        public java.util.List<Declaration> getDeclarations()
      • getDeclarationsByName

        public <T extends Declaration> @NonNull java.util.Set<T> getDeclarationsByName​(@NonNull java.lang.String name,
                                                                                       @NonNull java.lang.Class<T> clazz)
        Returns a non-null, possibly empty Set of the declaration of a specified type and clazz.
        Type Parameters:
        T - the type of the declaration
        Parameters:
        name - the name to search for
        clazz - the declaration class, such as FunctionDeclaration.
        Returns:
        a Set containing the declarations, if any.
      • getDeclarationAs

        public <T> T getDeclarationAs​(int i,
                                      java.lang.Class<T> clazz)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class Node
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Node