Class ModuleNode

  • All Implemented Interfaces:
    org.objectweb.asm.Opcodes

    public class ModuleNode
    extends ASTNode
    implements org.objectweb.asm.Opcodes
    Represents a module, which consists typically of a class declaration but could include some imports, some statements and multiple classes intermixed with statements like scripts in Python or Ruby
    • Constructor Detail

      • ModuleNode

        public ModuleNode​(SourceUnit context)
    • Method Detail

      • getMethods

        public java.util.List<MethodNode> getMethods()
      • getClasses

        public java.util.List<ClassNode> getClasses()
      • getImports

        public java.util.List<ImportNode> getImports()
      • getStarImports

        public java.util.List<ImportNode> getStarImports()
      • getStaticImports

        public java.util.Map<java.lang.String,​ImportNode> getStaticImports()
      • getStaticStarImports

        public java.util.Map<java.lang.String,​ImportNode> getStaticStarImports()
      • getImportType

        public ClassNode getImportType​(java.lang.String alias)
        Parameters:
        alias - the name of interest
        Returns:
        the class node for the given alias or null if none is available
      • getImport

        public ImportNode getImport​(java.lang.String alias)
        Parameters:
        alias - the name of interest
        Returns:
        the import node for the given alias or null if none is available
      • addImport

        public void addImport​(java.lang.String alias,
                              ClassNode type)
      • addImport

        public void addImport​(java.lang.String alias,
                              ClassNode type,
                              java.util.List<AnnotationNode> annotations)
      • addStarImport

        public void addStarImport​(java.lang.String packageName)
      • addStarImport

        public void addStarImport​(java.lang.String packageName,
                                  java.util.List<AnnotationNode> annotations)
      • addStaticImport

        public void addStaticImport​(ClassNode type,
                                    java.lang.String fieldName,
                                    java.lang.String alias)
      • addStaticImport

        public void addStaticImport​(ClassNode type,
                                    java.lang.String fieldName,
                                    java.lang.String alias,
                                    java.util.List<AnnotationNode> annotations)
      • addStaticStarImport

        public void addStaticStarImport​(java.lang.String name,
                                        ClassNode type)
      • addStaticStarImport

        public void addStaticStarImport​(java.lang.String name,
                                        ClassNode type,
                                        java.util.List<AnnotationNode> annotations)
      • addStatement

        public void addStatement​(Statement node)
      • addClass

        public void addClass​(ClassNode node)
      • addMethod

        public void addMethod​(MethodNode node)
      • getPackageName

        public java.lang.String getPackageName()
      • setPackage

        public void setPackage​(PackageNode packageNode)
      • setPackageName

        public void setPackageName​(java.lang.String packageName)
      • hasPackageName

        public boolean hasPackageName()
      • hasPackage

        public boolean hasPackage()
      • getDescription

        public java.lang.String getDescription()
        Returns:
        the underlying character stream description
      • setDescription

        public void setDescription​(java.lang.String description)
      • getScriptClassDummy

        public ClassNode getScriptClassDummy()
      • createStatementsClass

        protected ClassNode createStatementsClass()
      • extractClassFromFileDescription

        protected java.lang.String extractClassFromFileDescription()
      • isEmpty

        public boolean isEmpty()
      • sortClasses

        public void sortClasses()
      • hasImportsResolved

        public boolean hasImportsResolved()
      • setImportsResolved

        public void setImportsResolved​(boolean importsResolved)
      • getMainClassName

        public java.lang.String getMainClassName()