java.lang.Object
com.realtime.crossfire.jxclient.settings.Settings

public class Settings extends Object
Maintains a set of key/value pairs. The values are stored in a flat file.
  • Constructor Details

    • Settings

      public Settings(@NotNull @NotNull Path file)
      Creates a new instance.
      Parameters:
      file - the file for loading/saving values
  • Method Details

    • getString

      @NotNull public @NotNull String getString(@NotNull @NotNull SettingsEntry<?> key)
      Returns the string associated with the specified key at a node, or defaultValue if there is no association for this key.
      Parameters:
      key - the key to get the value for
      Returns:
      the value
    • getBoolean

      public boolean getBoolean(@NotNull @NotNull SettingsEntry<Boolean> key)
      Returns the boolean associated with the specified key at a node or defaultValue if there is no association for this key.
      Parameters:
      key - the key to get the value for
      Returns:
      the value
    • getInt

      public int getInt(@NotNull @NotNull SettingsEntry<Integer> key)
      Returns the integer associated with the specified key at a node or defaultValue if there is no association for this key.
      Parameters:
      key - the key to get the value for
      Returns:
      the value
    • getLong

      public long getLong(@NotNull @NotNull SettingsEntry<Long> key)
      Returns the long associated with the specified key at a node or defaultValue if there is no association for this key.
      Parameters:
      key - the key to get the value for
      Returns:
      the value
    • putString

      public void putString(@NotNull @NotNull SettingsEntry<?> key, @NotNull @NotNull String value)
      Stores a key/value pair.
      Parameters:
      key - the key to store
      value - the value to store
    • putBoolean

      public void putBoolean(@NotNull @NotNull SettingsEntry<Boolean> key, boolean value)
      Stores a key/value pair.
      Parameters:
      key - the key to store
      value - the value to store
    • putInt

      public void putInt(@NotNull @NotNull SettingsEntry<Integer> key, int value)
      Stores a key/value pair.
      Parameters:
      key - the key to store
      value - the value to store
    • putLong

      public void putLong(@NotNull @NotNull SettingsEntry<Long> key, long value)
      Stores a key/value pair.
      Parameters:
      key - the key to store
      value - the value to store
    • remove

      public void remove(@NotNull @NotNull String key)
      Removes a key. Does nothing if the key has no associated value.
      Parameters:
      key - the key to remove