Class FileManager

java.lang.Object
dev.selena.luacore.utils.config.FileManager

public class FileManager extends Object
Internally used file manager for loading, creating, and saving files
  • Constructor Details

    • FileManager

      public FileManager()
      Used for initial class setup
  • Method Details

    • file

      public static File file(String parent, String file)
      Returns the specified file
      Parameters:
      parent - The parent folder
      file - File name
      Returns:
      The file you requested
    • folder

      public static File folder(String path)
      Used for getting a folder
      Parameters:
      path - The folder name relative to your plugin data folder
      Returns:
      The folder in the form of a Java File
    • folderPath

      public static String folderPath(String path)
      Returns a folder from your Plugins data folder
      Parameters:
      path - Folder name inside the data folder
      Returns:
      A string path of the requested folder
    • loadFile

      Uses the GSON ConfigLoader class to map the config json to the specified class
      Type Parameters:
      T - Class type
      Parameters:
      clazz - The class type you want it to be mapped to
      file - The file you are mapping from
      Returns:
      Class T mapped with the data from the Json file
      Throws:
      IOException - Thrown when the file can not be found
      InstantiationException - Throwing when the class has an initialization issue
      IllegalAccessException - Thrown when trying to access a field without the correct access level
      InvocationTargetException - Thrown when the mapper class has a constructor that does not match the arguments (There should be none)
      NoSuchMethodException - Thrown when the class somehow manages not to have a constructor
      See Also:
    • get

      public static FileManager get()
      Used for getting the instance of this class
      Returns:
      FileManager instance