Class MacroObjectMap
java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.maps.MacroObjectMap
A key-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> void
Inserts a key-value pair into the map.<T> void
putIfAbsent
(MacroKey macroKey, T value) Inserts a key-value pair only if the key is not already present in the map.
-
Constructor Details
-
MacroObjectMap
public MacroObjectMap()
-
-
Method Details
-
put
Inserts a key-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 key under which the value should be storedvalue
- the value to store, or"NULL"
if null
-
putIfAbsent
Inserts a key-value pair only if the key 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 key to insertvalue
- the value to associate, or"NULL"
if null
-
get
Retrieves the value associated with the specifiedMacroKey
, if present.- Parameters:
macroKey
- the key whose value to retrieve- Returns:
- an
Optional
containing the associated value, or empty if not found
-