Class ScriptSettings


  • public class ScriptSettings
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptSettings()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T load​(java.lang.Class<T> clazz, java.lang.String... fileLocationSteps)
      Loads a given class from a settings object, location base is scripts.path
      static boolean save​(java.lang.Object obj, java.lang.String... fileLocationSteps)
      Saves a given object using GSON pretty print to the given file.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScriptSettings

        public ScriptSettings()
    • Method Detail

      • load

        public static <T> T load​(java.lang.Class<T> clazz,
                                 java.lang.String... fileLocationSteps)
        Loads a given class from a settings object, location base is scripts.path
        Parameters:
        clazz - Class of the object you're loading, must have empty constructor
        fileLocationSteps - Steps in the file location, eg: "MyScript","SubFolder","MySettings.json
        Returns:
        A new instance of your object created from the file settings.
      • save

        public static boolean save​(java.lang.Object obj,
                                   java.lang.String... fileLocationSteps)
        Saves a given object using GSON pretty print to the given file.
        Parameters:
        obj - Object instance to save.
        fileLocationSteps - Steps in the file location, eg: "MyScript","SubFolder","MySettings.json
        Returns:
        true if it saves with no exceptions, false if it fails to create folders or throws exceptions