java.lang.Object
com.winterhavenmc.library.messagebuilder.pipeline.resolvers.AtomicResolver
All Implemented Interfaces:
Resolver

public class AtomicResolver extends Object implements Resolver
A Resolver implementation that handles simple or atomic values, converting them into formatted strings mapped directly to the base MacroKey.

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 key only if no value already exists for it.
See Also:
  • Constructor Details

    • AtomicResolver

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

    • resolve

      public MacroStringMap resolve(MacroKey macroKey, MacroObjectMap macroObjectMap)
      Resolves a single value mapped to the provided MacroKey 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 Resolver
      Parameters:
      macroKey - the key 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 key-value pair