Class MemorySectionMethods<T extends AbstractMemorySection<?>>
java.lang.Object
com.kamikazejam.kamicommon.yaml.AbstractMemorySection<T>
com.kamikazejam.kamicommon.yaml.base.MemorySectionMethods<T>
- Direct Known Subclasses:
MemorySectionStandalone
public abstract class MemorySectionMethods<T extends AbstractMemorySection<?>>
extends AbstractMemorySection<T>
-
Constructor Summary
ConstructorsConstructorDescriptionMemorySectionMethods(@Nullable org.yaml.snakeyaml.nodes.MappingNode node, @Nullable ConfigurationMethods<?> parent) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDefault(String key, Object o) booleangetBigDecimal(String key) getBigDecimal(String key, BigDecimal def) booleangetBoolean(String key) booleangetBoolean(String key, boolean def) bytebytegetByteList(String key) getByteList(String key, List<Byte> def) doubledoublefloatfloatintintgetIntegerList(String key) getIntegerList(String key, List<Integer> def) 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 valueList<?> List<?> longlongshortshortgetStringList(String key) getStringList(String key, List<String> def) booleanWhether the value at this key is onegetBoolean(String, boolean)would parse, rather than fall back to its default for.booleanbooleanbooleanbooleanisEmpty()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidputBoolean(String key, boolean value) voidvoidvoidvoidvoidputInteger(String key, int value) voidvoidvoidbooleansave(@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.booleansave(@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.voidsetBoolean(String key, boolean value) voidvoidvoidvoidvoidsetInteger(String key, int value) voidvoidvoidMethods inherited from class AbstractMemorySection
contains, getKeyNode, getKeys, getNode, getNodeTuple, getNodeValue, getObject, internalPut, isPrimitiveWrapper, parseBigDecimal, put, set, setChanged
-
Constructor Details
-
MemorySectionMethods
public MemorySectionMethods(@Nullable @Nullable org.yaml.snakeyaml.nodes.MappingNode node, @Nullable @Nullable ConfigurationMethods<?> parent)
-
-
Method Details
-
get
-
get
-
putString
-
setString
-
putBoolean
-
setBoolean
-
putInteger
-
putInt
-
setInteger
-
setInt
-
putLong
-
setLong
-
putDouble
-
setDouble
-
putFloat
-
setFloat
-
putByte
-
setByte
-
putShort
-
setShort
-
getString
-
getString
-
isString
-
getBoolean
-
getBoolean
-
isBoolean
Whether the value at this key is onegetBoolean(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:andhide-attributes:on an item, andhide-attributes:on a menu icon, were all parsed and then discarded.Uses
get(key), notget(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
-
getByte
-
isByte
-
getShort
-
getShort
-
isShort
-
getInt
-
getInt
-
isInt
-
getLong
-
getLong
-
isLong
-
getFloat
-
getFloat
-
isFloat
-
getDouble
-
getDouble
-
isDouble
-
getBigDecimal
-
getBigDecimal
-
isNumber
-
getList
-
getList
-
isList
-
getStringList
-
getStringList
-
getIntegerList
-
getIntegerList
-
getByteList
-
getByteList
-
getKeys
-
isConfigurationSection
-
contains
-
isSet
-
addDefault
-
isEmpty
public boolean isEmpty() -
save
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
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 abstractionforce- 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)
-