Class AsyncKarmaFile

java.lang.Object
ml.karmaconfigs.api.common.karmafile.AsyncKarmaFile
All Implemented Interfaces:
Serializable

public final class AsyncKarmaFile extends Object implements Serializable
Karma file
See Also:
Serialized Form
  • Constructor Details

    • AsyncKarmaFile

      public AsyncKarmaFile(KarmaSource source, String name, String... dir) throws IllegalStateException
      Initialize the karma file
      Parameters:
      source - the file source
      name - the file name
      dir - the file path
      Throws:
      IllegalStateException - if the target path is not a valid path
    • AsyncKarmaFile

      public AsyncKarmaFile(File target)
      Initialize the karma file
      Parameters:
      target - the target karma file
    • AsyncKarmaFile

      public AsyncKarmaFile(Path target)
      Initialize the karma file
      Parameters:
      target - the target karma file
  • Method Details

    • exportFromFile

      public LateScheduler<Void> exportFromFile(InputStream resource)
      Export the karma file from an internal file
      Parameters:
      resource - the internal file
      Returns:
      the result
    • applyKarmaAttribute

      public LateScheduler<Void> applyKarmaAttribute()
      Apply karma file attribute to the file
      Returns:
      the result
    • create

      public LateScheduler<Void> create()
      Create the file
      Returns:
      the result
    • set

      public LateScheduler<Void> set(Object value)
      Set a new value
      Parameters:
      value - the value
      Returns:
      the result
    • set

      public LateScheduler<Void> set(String path, Object value)
      Set a new value
      Parameters:
      path - the key path
      value - the value
      Returns:
      the result
    • set

      public LateScheduler<Void> set(String path, List<?> list)
      Set a new value
      Parameters:
      path - the key path
      list - the values
      Returns:
      the result
    • unset

      public LateScheduler<Void> unset(String path)
      Unset a key and its value if set
      Parameters:
      path - the key path
      Returns:
      the result
    • unsetList

      public LateScheduler<Void> unsetList(String path)
      Unset a list
      Parameters:
      path - the list path
      Returns:
      the result
    • delete

      public void delete()
      Delete the file
    • get

      @NotNull public @NotNull LateScheduler<Object> get(String path, @NotNull @NotNull Object def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getString

      @NotNull public @NotNull LateScheduler<String> getString(String path, @NotNull @NotNull String def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getList

      @NotNull public @NotNull LateScheduler<List<?>> getList(String path, Object... default_contents)
      Get a value
      Parameters:
      path - the value path
      default_contents - the default values
      Returns:
      the value
    • getStringList

      @NotNull public @NotNull LateScheduler<List<String>> getStringList(String path, String... default_contents)
      Get a value
      Parameters:
      path - the value path
      default_contents - the default values
      Returns:
      the value
    • readFullFile

      @NotNull public @NotNull LateScheduler<List<String>> readFullFile()
      Read the file completely
      Returns:
      the file lines
    • getBoolean

      public LateScheduler<Boolean> getBoolean(String path, boolean def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • isList

      public LateScheduler<Boolean> isList(String path)
      Get if a key is a list
      Parameters:
      path - the key
      Returns:
      if the path is a list
    • isSet

      public LateScheduler<Boolean> isSet(String path)
      Get if a key is set
      Parameters:
      path - the key
      Returns:
      if the path is set
    • getInt

      public LateScheduler<Integer> getInt(String path, int def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getDouble

      public LateScheduler<Double> getDouble(String path, double def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getLong

      public LateScheduler<Long> getLong(String path, long def)
      Get a value
      Parameters:
      path - the value path
      def - the default value
      Returns:
      the value
    • getFile

      public File getFile()
      Get the file
      Returns:
      the file
    • exists

      public boolean exists()
      Get if the file exists
      Returns:
      if the file exists
    • getKeys

      public LateScheduler<Set<Key>> getKeys(boolean deep)
      Get the karma file key set
      Parameters:
      deep - include non-valued keys
      Returns:
      the karma file keys
    • toString

      public String toString()
      Get the karma file as string
      Overrides:
      toString in class Object
      Returns:
      the karma file as string