Class MapPairedDataMemory
java.lang.Object
me.a8kj.config.template.memory.impl.MapPairedDataMemory
- All Implemented Interfaces:
DataMemory<String>,PairedDataMemory<String>
A implementation of
PairedDataMemory specialized for String keys.
This class serves as a concrete storage handler, utilizing a HashMap
to manage configuration entries while providing integrated support for text placeholders.- Since:
- 0.1
- Author:
- a8kj7sea
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all data currently held in memory.booleanChecks if the memory contains a specific key.Retrieves a raw object from memory by its key.booleangetBoolean(String key, boolean defaultValue) Retrieves a value as a boolean.doubleRetrieves a value as a double.intRetrieves a value as an integer.Retrieves a set of keys under a specific path.Retrieves a value as aString.getStringList(String key) Retrieves a list of strings from the specified key.voidSets a value in the memory buffer for the specified key.transform(String text, Replacement... replacements) Processes placeholders within the given text using theReplacementProcessor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.a8kj.config.template.memory.DataMemory
get, getOptional, getProcessor, getString, getStringListMethods inherited from interface me.a8kj.config.template.memory.impl.PairedDataMemory
fetchDetailed
-
Constructor Details
-
MapPairedDataMemory
public MapPairedDataMemory()
-
-
Method Details
-
set
Description copied from interface:DataMemorySets a value in the memory buffer for the specified key.- Specified by:
setin interfaceDataMemory<String>- Parameters:
key- the key where the value should be stored.value- the object to store.
-
get
Description copied from interface:DataMemoryRetrieves a raw object from memory by its key.- Specified by:
getin interfaceDataMemory<String>- Parameters:
key- the key to lookup.- Returns:
- the stored object, or
nullif not found.
-
getString
Description copied from interface:DataMemoryRetrieves a value as aString.- Specified by:
getStringin interfaceDataMemory<String>- Parameters:
key- the key to lookup.- Returns:
- the string representation of the value.
-
getInt
Description copied from interface:DataMemoryRetrieves a value as an integer.- Specified by:
getIntin interfaceDataMemory<String>
-
getBoolean
Description copied from interface:DataMemoryRetrieves a value as a boolean.- Specified by:
getBooleanin interfaceDataMemory<String>
-
getDouble
Description copied from interface:DataMemoryRetrieves a value as a double.- Specified by:
getDoublein interfaceDataMemory<String>
-
getStringList
Description copied from interface:DataMemoryRetrieves a list of strings from the specified key.- Specified by:
getStringListin interfaceDataMemory<String>
-
contains
Description copied from interface:DataMemoryChecks if the memory contains a specific key.- Specified by:
containsin interfaceDataMemory<String>
-
getKeys
Description copied from interface:DataMemoryRetrieves a set of keys under a specific path.- Specified by:
getKeysin interfaceDataMemory<String>- Parameters:
path- the parent path.deep- whether to include keys from nested sections.- Returns:
- a set of keys.
-
clear
public void clear()Description copied from interface:DataMemoryClears all data currently held in memory.- Specified by:
clearin interfaceDataMemory<String>
-
transform
Processes placeholders within the given text using theReplacementProcessor.- Specified by:
transformin interfaceDataMemory<String>- Parameters:
text- the string template containing placeholders.replacements- the variable data to inject into the template.- Returns:
- a formatted string with all replacements applied.
-