Class ImplJSourceFile

    • Field Detail

      • imports

        private final java.util.Map<java.lang.String,​AbstractJType> imports
      • staticImports

        private final java.util.Map<java.lang.String,​StaticRefJExpr> staticImports
      • packageName

        private final java.lang.String packageName
      • fileName

        private final java.lang.String fileName
      • packageWritten

        private boolean packageWritten
    • Constructor Detail

      • ImplJSourceFile

        ImplJSourceFile​(ImplJSources sources,
                        java.lang.String packageName,
                        java.lang.String fileName)
    • Method Detail

      • checkPackage

        private void checkPackage()
      • hasImport

        boolean hasImport​(java.lang.String name)
      • hasStaticImport

        boolean hasStaticImport​(java.lang.String name)
      • hasStaticImport

        boolean hasStaticImport​(java.lang.String name,
                                AbstractJType enclosingType)
      • _import

        public JSourceFile _import​(java.lang.String type)
        Description copied from interface: JSourceFile
        Add a type import to this source file.
        Specified by:
        _import in interface JSourceFile
        Parameters:
        type - the type to import
        Returns:
        this source file
      • _import

        public JSourceFile _import​(JType type)
        Description copied from interface: JSourceFile
        Add a type import to this source file.
        Specified by:
        _import in interface JSourceFile
        Parameters:
        type - the type to import
        Returns:
        this source file
      • _import

        public JSourceFile _import​(java.lang.Class<?> type)
        Description copied from interface: JSourceFile
        Add a type import to this source file.
        Specified by:
        _import in interface JSourceFile
        Parameters:
        type - the type to import
        Returns:
        this source file
      • importStatic

        public JSourceFile importStatic​(java.lang.String type,
                                        java.lang.String member)
        Description copied from interface: JSourceFile
        Add a static member import to this source file.
        Specified by:
        importStatic in interface JSourceFile
        Parameters:
        type - the type to import from
        member - the member name
        Returns:
        this source file
      • importStatic

        public JSourceFile importStatic​(JType type,
                                        java.lang.String member)
        Description copied from interface: JSourceFile
        Add a static member import to this source file.
        Specified by:
        importStatic in interface JSourceFile
        Parameters:
        type - the type to import from
        member - the member name
        Returns:
        this source file
      • importStatic

        public JSourceFile importStatic​(java.lang.Class<?> type,
                                        java.lang.String member)
        Description copied from interface: JSourceFile
        Add a static member import to this source file.
        Specified by:
        importStatic in interface JSourceFile
        Parameters:
        type - the type to import from
        member - the member name
        Returns:
        this source file
      • blankLine

        public JSourceFile blankLine()
        Description copied from interface: JSourceFile
        Add a blank line to this source file. If sorting is enabled, blank lines may be lost.
        Specified by:
        blankLine in interface JSourceFile
        Returns:
        this source file
      • _class

        public JClassDef _class​(int mods,
                                java.lang.String name)
        Description copied from interface: JSourceFile
        Add a class definition to this source file.
        Specified by:
        _class in interface JSourceFile
        Parameters:
        mods - the modifiers
        name - the class name
        Returns:
        the class definition
      • _enum

        public JClassDef _enum​(int mods,
                               java.lang.String name)
        Description copied from interface: JSourceFile
        Add an enum definition to this source file.
        Specified by:
        _enum in interface JSourceFile
        Parameters:
        mods - the modifiers
        name - the enum name
        Returns:
        the enum definition
      • _interface

        public JClassDef _interface​(int mods,
                                    java.lang.String name)
        Description copied from interface: JSourceFile
        Add an interface definition to this source file.
        Specified by:
        _interface in interface JSourceFile
        Parameters:
        mods - the modifiers
        name - the interface name
        Returns:
        the interface definition
      • annotationInterface

        public JClassDef annotationInterface​(int mods,
                                             java.lang.String name)
        Description copied from interface: JSourceFile
        Add an annotation interface definition to this source file.
        Specified by:
        annotationInterface in interface JSourceFile
        Parameters:
        mods - the modifiers
        name - the annotation interface name
        Returns:
        the annotation interface definition
      • getPackageName

        java.lang.String getPackageName()
      • getFileName

        java.lang.String getFileName()
      • write

        void write​(SourceFileWriter sourceFileWriter)
            throws java.io.IOException
        Throws:
        java.io.IOException