Class JavaFile

  • Direct Known Subclasses:
    JavaFileImpl

    public abstract class JavaFile
    extends java.lang.Object
    Interface for objects which wish to provide meta-info about a JavaFile.
    • Field Detail

      • imports

        private java.util.Set<ImportType> imports
      • classTypes

        private java.util.List<ClassType> classTypes
      • path

        private final java.nio.file.Path path
      • filename

        private java.lang.String filename
      • encoding

        private final java.lang.String encoding
    • Constructor Detail

      • JavaFile

        protected JavaFile​(java.nio.file.Path path,
                           java.lang.String encoding)
    • Method Detail

      • getImportTypes

        public java.util.Set<ImportType> getImportTypes()
        Gets the imported packages/files that this package has.
        Returns:
        import types
      • getClassType

        public ClassType getClassType()
        Gets the name of this class.
        Returns:
        class type
      • getClassTypes

        public java.util.List<ClassType> getClassTypes()
        Gets the names of the classes in this file.
        Returns:
        list of class types
      • getPackageType

        public PackageType getPackageType()
        Gets the package of this class.
        Returns:
        package type
      • addClassType

        public void addClassType​(ClassType classType)
        Add a class type to the current list of class types.
        Parameters:
        classType - class type
      • addImportType

        public void addImportType​(ImportType importType)
        Add an import type.
        Parameters:
        importType - import type
      • setClassType

        public void setClassType​(ClassType classType)
        Sets the name of this class.
        Parameters:
        classType - class type
      • setPackageType

        public void setPackageType​(PackageType packageType)
        Sets the package type of this class.
        Parameters:
        packageType - package type
      • getPath

        public java.nio.file.Path getPath()
        Gets the path attribute.
        Returns:
        path
      • getFilename

        public java.lang.String getFilename()
        Gets the file name without path and extension.
        Returns:
        file name
      • getEncoding

        public java.lang.String getEncoding()
        Gets the encoding attribute.
        Returns:
        encoding
      • getFilenameWithoutPathOrExtension

        protected static java.lang.String getFilenameWithoutPathOrExtension​(java.nio.file.Path path)
        Remove the path and the ".java" extension from a filename.
        Parameters:
        path - path to modify
        Returns:
        modified path