Class JsonSettings

java.lang.Object
com.xpdustry.simple_blacklist.util.JsonSettings

public class JsonSettings extends Object
  • Field Details

    • file

      protected final arc.files.Fi file
    • values

      protected final arc.struct.ArrayMap<String,arc.util.serialization.JsonValue> values
    • reader

      protected final arc.util.serialization.JsonReader reader
    • json

      protected arc.util.serialization.Json json
    • modified

      protected boolean modified
  • Constructor Details

    • JsonSettings

      public JsonSettings(arc.files.Fi file)
  • Method Details

    • setJson

      public void setJson(arc.util.serialization.Json json)
    • getJson

      public arc.util.serialization.Json getJson()
    • modified

      public boolean modified()
    • load

      public void load()
      Loads all values.
    • save

      public void save()
      Saves all values.
    • loadValues

      public void loadValues(arc.files.Fi file) throws IOException
      Throws:
      IOException
    • saveValues

      public void saveValues(arc.files.Fi file) throws IOException
      Throws:
      IOException
    • exists

      public boolean exists()
      Return whether the file exists or not.
    • file

      public arc.files.Fi file()
      Returns the file used for writing settings to.
    • clear

      public void clear()
      Clears all preference values.
    • keys

      public Iterable<String> keys()
    • size

      public int size()
    • has

      public boolean has(String name)
    • remove

      public void remove(String name)
    • put

      public void put(String name, Object value)
    • put

      public <E> void put(String name, Class<E> elementType, Object value)
    • put

      public <K, E> void put(String name, Class<E> elementType, Class<K> keyType, Object value)
      Note that keyType is not supported and ignored. Object keys are converted using String.valueOf(Object).
    • get

      public <T> T get(String name, Class<T> type, T def)
    • get

      public <T, E> T get(String name, Class<T> type, Class<E> elementType, T def)
    • get

      public <T, K, E> T get(String name, Class<T> type, Class<E> elementType, Class<K> keyType, T def)
    • getOrPut

      public <T> T getOrPut(String name, Class<T> type, T def)
    • getOrPut

      public <T, E> T getOrPut(String name, Class<T> type, Class<E> elementType, T def)
      Put and return def if the name key is not found
    • getOrPut

      public <T, K, E> T getOrPut(String name, Class<T> type, Class<E> elementType, Class<K> keyType, T def)
      Put and return def if the name key is not found
    • getFloat

      public float getFloat(String name, float def)
    • getDouble

      public double getDouble(String name, double def)
    • getInt

      public int getInt(String name, int def)
    • getLong

      public long getLong(String name, long def)
    • getBool

      public boolean getBool(String name, boolean def)
    • getString

      public String getString(String name, String def)
    • getFloat

      public float getFloat(String name)
    • getDouble

      public double getDouble(String name)
    • getInt

      public int getInt(String name)
    • getLong

      public long getLong(String name)
    • getBool

      public boolean getBool(String name)
    • getBoolOnce

      public void getBoolOnce(String name, Runnable run)
      Runs the specified code once, and never again.
    • getBoolOnce

      public boolean getBoolOnce(String name)
      Returns false once, and never again.
    • getString

      public String getString(String name)
      Returns:
      null if not found