Class MemorySectionMethods<T extends AbstractMemorySection<?>>

java.lang.Object
com.kamikazejam.kamicommon.yaml.AbstractMemorySection<T>
com.kamikazejam.kamicommon.yaml.base.MemorySectionMethods<T>
Direct Known Subclasses:
MemorySection, MemorySectionStandalone

public abstract class MemorySectionMethods<T extends AbstractMemorySection<?>> extends AbstractMemorySection<T>
  • Constructor Details

    • MemorySectionMethods

      public MemorySectionMethods(@Nullable @Nullable org.yaml.snakeyaml.nodes.MappingNode node, @Nullable @Nullable ConfigurationMethods<?> parent)
  • Method Details

    • get

      public Object get(String key)
    • get

      public Object get(String key, Object def)
    • putString

      public void putString(String key, String value)
    • setString

      public void setString(String key, String value)
    • putBoolean

      public void putBoolean(String key, boolean value)
    • setBoolean

      public void setBoolean(String key, boolean value)
    • putInteger

      public void putInteger(String key, int value)
    • putInt

      public void putInt(String key, int value)
    • setInteger

      public void setInteger(String key, int value)
    • setInt

      public void setInt(String key, int value)
    • putLong

      public void putLong(String key, long value)
    • setLong

      public void setLong(String key, long value)
    • putDouble

      public void putDouble(String key, double value)
    • setDouble

      public void setDouble(String key, double value)
    • putFloat

      public void putFloat(String key, float value)
    • setFloat

      public void setFloat(String key, float value)
    • putByte

      public void putByte(String key, byte value)
    • setByte

      public void setByte(String key, byte value)
    • putShort

      public void putShort(String key, short value)
    • setShort

      public void setShort(String key, short value)
    • getString

      public String getString(String key)
    • getString

      public String getString(String key, String def)
    • isString

      public boolean isString(String key)
    • getBoolean

      public boolean getBoolean(String key)
    • getBoolean

      public boolean getBoolean(String key, boolean def)
    • isBoolean

      public boolean isBoolean(String key)
      Whether the value at this key is one getBoolean(String, boolean) would parse, rather than fall back to its default for.

      This was get(key) instanceof Boolean, which could never be true for a value read from a yaml file, because scalars come back as strings. Every caller gating on it was dead: unbreakable: and hide-attributes: on an item, and hide-attributes: on a menu icon, were all parsed and then discarded.

      Uses get(key), not get(key, def): a missing key must answer false, and the defaulting overload would hand back the default and make every missing key look set.

    • getByte

      public byte getByte(String key)
    • getByte

      public byte getByte(String key, byte def)
    • isByte

      public boolean isByte(String key)
    • getShort

      public short getShort(String key)
    • getShort

      public short getShort(String key, short def)
    • isShort

      public boolean isShort(String key)
    • getInt

      public int getInt(String key)
    • getInt

      public int getInt(String key, int def)
    • isInt

      public boolean isInt(String key)
    • getLong

      public long getLong(String key)
    • getLong

      public long getLong(String key, long def)
    • isLong

      public boolean isLong(String key)
    • getFloat

      public float getFloat(String key)
    • getFloat

      public float getFloat(String key, float def)
    • isFloat

      public boolean isFloat(String key)
    • getDouble

      public double getDouble(String key)
    • getDouble

      public double getDouble(String key, double def)
    • isDouble

      public boolean isDouble(String key)
    • getBigDecimal

      public BigDecimal getBigDecimal(String key)
    • getBigDecimal

      public BigDecimal getBigDecimal(String key, BigDecimal def)
    • isNumber

      public boolean isNumber(String key)
    • getList

      public List<?> getList(String key)
    • getList

      public List<?> getList(String key, List<?> def)
    • isList

      public boolean isList(String key)
    • getStringList

      public List<String> getStringList(String key)
    • getStringList

      public List<String> getStringList(String key, List<String> def)
    • getIntegerList

      public List<Integer> getIntegerList(String key)
    • getIntegerList

      public List<Integer> getIntegerList(String key, List<Integer> def)
    • getByteList

      public List<Byte> getByteList(String key)
    • getByteList

      public List<Byte> getByteList(String key, List<Byte> def)
    • getKeys

      public Set<String> getKeys(boolean deep)
      Returns the keys of the config If Deep is enabled, it will dig and find all valid keys that resolve to a value
      Parameters:
      deep - Whether to search for all sub-keys
      Returns:
      The list of keys found
    • isConfigurationSection

      public boolean isConfigurationSection(String key)
    • contains

      public boolean contains(String key)
    • isSet

      public boolean isSet(String key)
    • addDefault

      public void addDefault(String key, Object o)
    • isEmpty

      public boolean isEmpty()
    • save

      public boolean save(@NotNull @NotNull ConfigSource source)
      Saves the config to the backing source.

      - If the source is not writable, this is a NO-OP and returns false.
      - If no changes are detected, returns false.
      - If writable and changes should be persisted, serialize and write.
      Parameters:
      source - The destination/source abstraction
      Returns:
      true IFF the config was saved successfully (may be skipped if not changed)
    • save

      public boolean save(@NotNull @NotNull ConfigSource source, boolean force)
      Saves the config to the backing source.

      - If the source is not writable, this is a NO-OP and returns false.
      - If force is false and no changes are detected, returns false.
      - If writable and changes should be persisted, serialize and write.
      Parameters:
      source - The destination/source abstraction
      force - If the config should be saved even if no changes were made
      Returns:
      true IFF the config was saved successfully (may be skipped if not changed and force is false)