Class AtomicResolver
java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.pipeline.resolvers.value.AtomicResolver
- All Implemented Interfaces:
ValueResolver
A
ValueResolver implementation that handles simple or atomic values,
converting them into formatted strings mapped directly to the base ValidMacroKey.
The AtomicResolver is typically used as the final step in a resolution chain,
after more complex resolvers (such as CompositeResolver) have had a chance
to handle structured objects. It processes values such as Boolean, String, Number,
Duration, and other primitive or directly representable types.
Formatting is applied for supported types:
Numbervalues are formatted using aNumberFormatterDurationandBoundedDurationvalues are formatted using aDurationFormatter- All other values fall back to
toString()
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAtomicResolver(FormatterCtx formatterCtx) Constructs anAtomicResolverusing the provided formatter container. -
Method Summary
Modifier and TypeMethodDescriptionresolve(ValidMacroKey macroKey, MacroObjectMap macroObjectMap) Resolves a single value mapped to the providedValidMacroKeyinto a string representation, if the object exists and can be formatted.
-
Constructor Details
-
AtomicResolver
Constructs anAtomicResolverusing the provided formatter container.- Parameters:
formatterCtx- a container providing formatters for durations and numbers- Throws:
IllegalArgumentException- if the formatter container isnull
-
-
Method Details
-
resolve
Resolves a single value mapped to the providedValidMacroKeyinto a string representation, if the object exists and can be formatted.Only one entry is produced per resolution: a single mapping from the
macroKeyto the formatted string value.- Specified by:
resolvein interfaceValueResolver- Parameters:
macroKey- the string used to retrieve the value from the macro object mapmacroObjectMap- the object map containing macro values to be resolved- Returns:
- a
MacroStringMapcontaining at most one resolved string-value pair
-