java.lang.Object
com.winterhavenmc.library.messagebuilder.adapters.pipeline.resolvers.value.AtomicResolver
All Implemented Interfaces:
ValueResolver

public class AtomicResolver extends Object implements 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:

The resolved value is added under the original macro string only if no value already exists for it.
See Also:
  • Constructor Details

    • AtomicResolver

      public AtomicResolver(FormatterCtx formatterCtx)
      Constructs an AtomicResolver using the provided formatter container.
      Parameters:
      formatterCtx - a container providing formatters for durations and numbers
      Throws:
      IllegalArgumentException - if the formatter container is null
  • Method Details

    • resolve

      public MacroStringMap resolve(ValidMacroKey macroKey, MacroObjectMap macroObjectMap)
      Resolves a single value mapped to the provided ValidMacroKey into a string representation, if the object exists and can be formatted.

      Only one entry is produced per resolution: a single mapping from the macroKey to the formatted string value.

      Specified by:
      resolve in interface ValueResolver
      Parameters:
      macroKey - the string used to retrieve the value from the macro object map
      macroObjectMap - the object map containing macro values to be resolved
      Returns:
      a MacroStringMap containing at most one resolved string-value pair