Module file.worker

Class FileInfo

java.lang.Object
io.github.astrapi69.file.create.FileInfo
Direct Known Subclasses:
FileContentInfo

public class FileInfo extends Object
The class FileInfo represents file information, including name, path, and directory flag.
  • Constructor Details

    • FileInfo

      public FileInfo(String name, String path, boolean directory)
      Constructs a new `FileInfo` with the given name, path, and directory flag.
      Parameters:
      name - the name of the file
      path - the path of the file
      directory - true if the file is a directory, false otherwise
    • FileInfo

      public FileInfo()
      Constructs a new empty `FileInfo`.
    • FileInfo

      public FileInfo(File file)
      Constructs a new `FileInfo` from the given File object.
      Parameters:
      file - the file from which to construct the `FileInfo`
      Throws:
      NullPointerException - if the file is null
    • FileInfo

      protected FileInfo(FileInfo.FileInfoBuilder<?,?> b)
      Constructs a new `FileInfo` from the builder.
      Parameters:
      b - the builder used to construct the `FileInfo`
  • Method Details

    • toFile

      public File toFile()
      Converts this `FileInfo` object to a File object.
      Returns:
      the new `File` object from this `FileInfo`
    • toFileInfo

      public static FileInfo toFileInfo(File file)
      Converts the given File object to a `FileInfo` object.
      Parameters:
      file - the file to convert to `FileInfo`
      Returns:
      a new `FileInfo` object from the given file
      Throws:
      NullPointerException - if the file is null
    • toFile

      public static File toFile(FileInfo fileInfo)
      Converts the given `FileInfo` object to a File object
      Parameters:
      fileInfo - the `FileInfo` object to convert to `File`
      Returns:
      the new `File` object the given `FileInfo` object
    • builder

      public static FileInfo.FileInfoBuilder<?,?> builder()
      Returns a builder for constructing `FileInfo` objects.
      Returns:
      a new instance of `FileInfoBuilder`
    • getName

      public String getName()
      Retrieves the name of the file.
      Returns:
      the name of the file
    • setName

      public void setName(String name)
      Sets the name of the file.
      Parameters:
      name - the new name to set
    • getPath

      public String getPath()
      Retrieves the path of the file.
      Returns:
      the path of the file
    • setPath

      public void setPath(String path)
      Sets the path of the file.
      Parameters:
      path - the new path to set
    • isDirectory

      public boolean isDirectory()
      Checks if the file is a directory.
      Returns:
      true if the file is a directory, false otherwise
    • setDirectory

      public void setDirectory(boolean directory)
      Sets whether the file is a directory.
      Parameters:
      directory - true if the file is a directory, false otherwise
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare
      Returns:
      true if this object is the same as the o argument; false otherwise
    • canEqual

      protected boolean canEqual(Object other)
      Internal method for checking equality with another object.
      Parameters:
      other - the object to compare with
      Returns:
      true if the objects can be considered equal, false otherwise
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object
    • toBuilder

      public FileInfo.FileInfoBuilder<?,?> toBuilder()
      Returns a builder initialized with the values of this `FileInfo` object.
      Returns:
      a new `FileInfoBuilder` initialized with this `FileInfo` values