Class MacroObjectMap
java.lang.Object
com.winterhavenmc.library.messagebuilder.core.maps.MacroObjectMap
A string-value map associating
MacroKey keys with arbitrary Object values,
used during macro substitution to store raw objects before formatting.
This class allows both put and putIfAbsent insertion behavior.
Null values are not permitted; any null value is automatically replaced
with the string literal "NULL".
Primarily intended for internal use within the message pipeline where macro
resolution requires intermediate object capture before string conversion.
This class is not thread-safe and uses a HashMap internally,
as message composition typically occurs on the main server thread within a single execution context.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the value associated with the specifiedMacroKey, if present.<T> voidInserts a string-value pair into the map.<T> voidputIfAbsent(MacroKey macroKey, T value) Inserts a string-value pair only if the string is not already present in the map.
-
Constructor Details
-
MacroObjectMap
public MacroObjectMap()
-
-
Method Details
-
put
Inserts a string-value pair into the map. If the value isnull, the string"NULL"is used instead.- Type Parameters:
T- the type of the value- Parameters:
macroKey- the string under which the value should be storedvalue- the value to store, or"NULL"if null
-
putIfAbsent
Inserts a string-value pair only if the string is not already present in the map. If the value isnull, the string"NULL"is used instead.- Type Parameters:
T- the type of the value- Parameters:
macroKey- the string to insertvalue- the value to associate, or"NULL"if null
-
get
Retrieves the value associated with the specifiedMacroKey, if present.- Parameters:
macroKey- the string whose value to retrieve- Returns:
- an
Optionalcontaining the associated value, or empty if not found
-